Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changelogs/fix_mb_convert_encoding.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
significance: minor
type: fixed
links:
- "#2672"
entry: Removes use of deprecated mb_convert_encoding().
6 changes: 4 additions & 2 deletions includes/class-llms-dom-document.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,16 @@ public function dom() {
}

/**
* Load the HTML string in the DOMDocument using mb_convert_econding
* Load the HTML string in the DOMDocument using mb_encode_numericentity
*
* @since 4.13.0
* @since [version] Use `mb_encode_numericentity()` instead of deprecated `mb_convert_encoding()` with 'HTML-ENTITIES'.
*
* @return void
*/
private function load_with_mb_convert_encoding() {
if ( ! $this->dom->loadHTML( mb_convert_encoding( $this->source, 'HTML-ENTITIES', 'UTF-8' ) ) ) {
$html = mb_encode_numericentity( $this->source, array( 0x80, 0x10FFFF, 0, 0x1FFFFF ), 'UTF-8' );
if ( ! $this->dom->loadHTML( $html ) ) {
$this->error = new WP_Error( 'llms-dom-document-error', __( 'DOMDocument XML Error encountered.', 'lifterlms' ), libxml_get_errors() );
}
}
Expand Down
Loading