facebook / hhvm

A virtual machine for executing programs written in Hack.
https://hhvm.com
Other
18.18k stars 2.99k forks source link

getElementsByTagName('tag') returning DOMText #5134

Closed andrerom closed 9 years ago

andrerom commented 9 years ago

This might be the culprit for issues reported in #2843 and elsewhere with the resulting error being: Fatal error: Call to undefined method DOMText::hasAttribute() / DOMText::setAttribute()

However DOMText does not have these method, it is rather that on hhvm we seem to get DOMText when we expect only DOMElement.

Example:

        foreach ( $document->getElementsByTagName( 'paragraph' ) as $paragraph )
        {
            if ( $paragraph->hasAttribute( 'xmlns:tmp' ) )

Links for this example: Travis, Code, TestCase, & Fixtures Note: Travis is currently on HHVM 3.5, however I could not see any issues relevant to this issue being fixed in 3.6

paulbiss commented 9 years ago

Any chance you could produce a short self-contained example demonstrating the problem? It also may be worth trying this against master as a number of bugs in ext_dom and ext_simplexml were recently fixed by 779b97a7c0a0f1c257f09727b20d86eb0f708e14.

andrerom commented 9 years ago

switched to hhvm-nightly and seems to indeed be fixed now, closing. ref: https://travis-ci.org/ezsystems/ezpublish-kernel/jobs/57335061