mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-01-24 06:11:52 +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:
parent
6f9aac9325
commit
fb8ad91cac
@ -213,7 +213,7 @@ class HTMLPurifier_Lexer_DOMLex extends HTMLPurifier_Lexer
|
|||||||
// this is code is only invoked for comments in script/style in versions
|
// 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
|
// of libxml pre-2.6.28 (regular comments, of course, are still
|
||||||
// handled regularly)
|
// handled regularly)
|
||||||
$tokens[] = $this->factory->createComment($node->data);
|
$tokens[] = $this->factory->createComment($node->data ?? null);
|
||||||
return false;
|
return false;
|
||||||
} elseif ($node->nodeType !== XML_ELEMENT_NODE) {
|
} elseif ($node->nodeType !== XML_ELEMENT_NODE) {
|
||||||
// not-well tested: there may be other nodes we have to grab
|
// 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();
|
$array = array();
|
||||||
foreach ($node_map as $attr) {
|
foreach ($node_map as $attr) {
|
||||||
|
if (!isset($attr->name)) continue;
|
||||||
$array[$attr->name] = $attr->value;
|
$array[$attr->name] = $attr->value;
|
||||||
}
|
}
|
||||||
return $array;
|
return $array;
|
||||||
|
Loading…
Reference in New Issue
Block a user