0
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2024-12-22 16:31:53 +00:00

Make tagName and node data detection hhvm compatible (#170)

This commit is contained in:
Mateusz Turcza 2018-03-04 19:22:03 +01:00 committed by Edward Z. Yang
parent c1167edbf1
commit 3cb77da11d

View File

@ -133,11 +133,11 @@ class HTMLPurifier_Lexer_DOMLex extends HTMLPurifier_Lexer
*/ */
protected function getTagName($node) protected function getTagName($node)
{ {
if (property_exists($node, 'tagName')) { if (isset($node->tagName)) {
return $node->tagName; return $node->tagName;
} else if (property_exists($node, 'nodeName')) { } else if (isset($node->nodeName)) {
return $node->nodeName; return $node->nodeName;
} else if (property_exists($node, 'localName')) { } else if (isset($node->localName)) {
return $node->localName; return $node->localName;
} }
return null; return null;
@ -150,11 +150,11 @@ class HTMLPurifier_Lexer_DOMLex extends HTMLPurifier_Lexer
*/ */
protected function getData($node) protected function getData($node)
{ {
if (property_exists($node, 'data')) { if (isset($node->data)) {
return $node->data; return $node->data;
} else if (property_exists($node, 'nodeValue')) { } else if (isset($node->nodeValue)) {
return $node->nodeValue; return $node->nodeValue;
} else if (property_exists($node, 'textContent')) { } else if (isset($node->textContent)) {
return $node->textContent; return $node->textContent;
} }
return null; return null;