-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Items in DOMNodelist not of registerNodeClass'd type #5412
Comments
Quick update to the sample code, now without XPath: class SampleElement extends \DOMElement {}
$dom = new DOMDocument();
$dom->registerNodeClass('DOMElement', 'SampleElement');
$dom->loadXML('<?xml version="1.0" ?><root />');
$list = $dom->childNodes;
var_dump(get_class($list->item(0))); |
Okay, looks like I broke this when I changed the libxml memory model. I think we're failing to copy over the classmap (and other associated data) to the new domdoc when we loadXML() (and loadHTML()). Should be a pretty easy fix if someone wants to send a PR (otherwise I'll try to get to it soon). |
That means a potential workaround would be to simply re-register the nodeclass replacements after loading. At least until this is fixed. |
Yeah, that still works. We should really fix this though. http://3v4l.org/ITRfI |
Using HHVM 3.7.0 the DOMNodelist returned by an XPath query does not honor the replacement of DOMElements via registerNodeClass.
_Running it against php_
PHP 5.6.9 (cli) (built: May 15 2015 10:04:17)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
with Xdebug v2.3.2, Copyright (c) 2002-2015, by Derick Rethans
string(13) "SampleElement"
_Running it against hhvm_
HipHop VM 3.7.0 (rel)
Compiler: 1432365749_210873458
Repo schema: de2ad6572c3e61a7c559656fe50ddb42d096626d
string(10) "DOMElement"
The text was updated successfully, but these errors were encountered: