Created
November 4, 2019 03:58
-
-
Save westonruter/e6762e351c40d2a480cbf5d63da9fa5c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/includes/sanitizers/class-amp-base-sanitizer.php b/includes/sanitizers/class-amp-base-sanitizer.php | |
index 2482db29..e2171079 100644 | |
--- a/includes/sanitizers/class-amp-base-sanitizer.php | |
+++ b/includes/sanitizers/class-amp-base-sanitizer.php | |
@@ -486,8 +486,12 @@ abstract class AMP_Base_Sanitizer { | |
} | |
$should_remove = $this->should_sanitize_validation_error( $validation_error, compact( 'node' ) ); | |
if ( $should_remove ) { | |
- $element->removeAttributeNode( $node ); | |
- $this->clean_up_after_attribute_removal( $element, $node, $validation_error ); | |
+ try { | |
+ $element->removeAttributeNode( $node ); | |
+ $this->clean_up_after_attribute_removal( $element, $node, $validation_error ); | |
+ } catch ( Exception $e ) { | |
+ error_log( sprintf( 'Failed to remove attribute %s from element %s', $node->nodeName, $element->nodeName ) ); | |
+ } | |
} | |
return $should_remove; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment