0
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-01-23 22:01:53 +00:00

Update DOMLex.php

Fixed two issues where property references that don't exist cause errors on PHP 8 (on docker setup by "tiredofit").
This commit is contained in:
Aman Patel 2021-05-20 13:14:48 -05:00 committed by GitHub
parent 6f9aac9325
commit fb8ad91cac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -213,7 +213,7 @@ class HTMLPurifier_Lexer_DOMLex extends HTMLPurifier_Lexer
// this is code is only invoked for comments in script/style in versions
// of libxml pre-2.6.28 (regular comments, of course, are still
// handled regularly)
$tokens[] = $this->factory->createComment($node->data);
$tokens[] = $this->factory->createComment($node->data ?? null);
return false;
} elseif ($node->nodeType !== XML_ELEMENT_NODE) {
// not-well tested: there may be other nodes we have to grab
@ -264,6 +264,7 @@ class HTMLPurifier_Lexer_DOMLex extends HTMLPurifier_Lexer
}
$array = array();
foreach ($node_map as $attr) {
if (!isset($attr->name)) continue;
$array[$attr->name] = $attr->value;
}
return $array;