facebook/hiphop-php — Issue #472: DOMDocument false class DOMText
Author: Eseph
Created: 2012-01-19 09:10:35+00:00
State: open

the following gives an error message:

$html = '

test

TEST

Span1textSpan2text

';

$dom = new DOMDocument();
if ($dom->loadHTML($html) === FALSE) {
die('error !!!'."\n");
} else {
print 'ok'."\n";
}
print get_class($dom)."\n";

$divelement = $dom->getElementById("divtest");
if ($divelement == NULL) {
die('error in getElementById !!'."\n");
}
print get_class($divelement)."\n";

$spans = $divelement->getElementsByTagName("span");
print get_class($spans)."\n";

running with php gives:

ok
DOMDocument
DOMElement
DOMNodeList

running with hiphop gives:

ok
DOMDocument
DOMText
HipHop Fatal error: Unknown method DOMText::getElementsByTagName in domtest.php on line 19

$divelement = $dom->getElementById("divtest"); should give a DOMElement, but in hiphop it gives a DOMText, so the method getElementsByTagName can't be called, but why ?