Skip to content

Commit

Permalink
Wrap DOM usage in libxml_disable_entity_loader
Browse files Browse the repository at this point in the history
  • Loading branch information
mdawaffe authored and jeherve committed Sep 9, 2019
1 parent b2a0560 commit 6c293bb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion modules/carousel/jetpack-carousel.php
Original file line number Diff line number Diff line change
Expand Up @@ -554,9 +554,11 @@ class_exists( 'Jetpack_AMP_Support' )
* The @ is not enough to suppress errors when dealing with libxml,
* we have to tell it directly how we want to handle errors.
*/
$old_libxml_use_internal_errors = libxml_use_internal_errors( true );
$old_libxml_disable_entity_loader = libxml_disable_entity_loader( true );
$old_libxml_use_internal_errors = libxml_use_internal_errors( true );
@$dom_doc->loadHTML( $html ); // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged
libxml_use_internal_errors( $old_libxml_use_internal_errors );
libxml_disable_entity_loader( $old_libxml_disable_entity_loader );

// Let's look for lists and divs.
$ul_tags = $dom_doc->getElementsByTagName( 'ul' );
Expand Down

0 comments on commit 6c293bb

Please sign in to comment.