-
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
DOM nodes changes identity #2962
Comments
Hrmmm. That's definitely an incompatibility with PHP5, but "fixing" it will take a fair amount of refactoring and probably just hurt perf in the end. Putting this on wishlist as we should probably find a way to make it work, but there's higher priority stuff to tackle. |
There is also a PHP bug that is related to this. It has a smaller side effect, but remains a unexpected behavior. |
Here is another effect that should be related to this issue. If you register an own class for a DOMNode descendant, the objected created by HHVM is still the superclass until the node is appended and changes its identity. Example: <?php
class MyElement extends \DOMElement {
public function __get($name) { return $this->$name; }
}
$dom = new DOMDocument();
$dom->registerNodeClass('DOMElement', 'MyElement');
$createdNode = $dom->createElement('foo');
$appendedNode = $dom->appendChild($createdNode);
var_dump(get_class($createdNode), get_class($appendedNode)); Expected:
Actual:
|
@paulbiss Does it cover this? $dom = new \DOMDocument('1.0', 'UTF-8');
$root = $dom->createElement('root');
$dom->appendChild($root);
// expected to be TRUE, actually FALSE
var_dump($root === $dom->documentElement); I can't see anything about it in 236c308. Nodes identity was the original scope of this issue. |
@goetas put the wrong issue number in the commit message |
My fix for #4126 should cover this (D1660716). It's up for internal review, I'll add this as a test. |
Nodes created by PHP, when added to DOM, changes their identity.
The text was updated successfully, but these errors were encountered: