0
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2024-12-22 08:21:52 +00:00

Skip counting currentNesting if null

This is an error starting in PHP 7.2
This commit is contained in:
John Flatness 2017-12-28 02:02:09 -05:00 committed by Edward Z. Yang
parent bb7ad66526
commit 6d6d88512a

View File

@ -157,11 +157,13 @@ abstract class HTMLPurifier_Injector
return false; return false;
} }
// check for exclusion // check for exclusion
for ($i = count($this->currentNesting) - 2; $i >= 0; $i--) { if (!empty($this->currentNesting)) {
$node = $this->currentNesting[$i]; for ($i = count($this->currentNesting) - 2; $i >= 0; $i--) {
$def = $this->htmlDefinition->info[$node->name]; $node = $this->currentNesting[$i];
if (isset($def->excludes[$name])) { $def = $this->htmlDefinition->info[$node->name];
return false; if (isset($def->excludes[$name])) {
return false;
}
} }
} }
return true; return true;