|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2016-05-11 14:57 UTC] jacksonpauls at gmail dot com
-PHP Version: 7.0.4
+PHP Version: 7.0.6
[2016-05-11 14:57 UTC] jacksonpauls at gmail dot com
[2020-11-05 15:24 UTC] cmb@php.net
-Assigned To:
+Assigned To: cmb
[2020-11-05 15:24 UTC] cmb@php.net
[2020-11-05 15:40 UTC] cmb@php.net
-Type: Bug
+Type: Documentation Problem
[2020-11-06 11:04 UTC] phpdocbot@php.net
[2020-11-06 11:04 UTC] phpdocbot@php.net
-Status: Assigned
+Status: Closed
[2020-11-07 05:20 UTC] phpdocbot@php.net
[2020-12-30 11:58 UTC] nikic@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 14:00:01 2025 UTC |
Description: ------------ When registering a new base node type with registerNodeClass: if I re-use variable names for created elements, then custom properties revert to their default value. Test script: --------------- <?php class myDOMElement extends DOMElement { public $myProp = 'Some default'; } $doc = new DOMDocument(); $doc->registerNodeClass('DOMElement', 'myDOMElement'); $node = $doc->createElement('a'); $node->myProp = 'A'; $doc->appendChild($node); # This seems to alter node A in $doc, not what I expected: $node = $doc->createElement('b'); $node->myProp = 'B'; $doc->appendChild($node); # Note: $nodeC instead of $node, this works fine. $nodeC = $doc->createElement('c'); $nodeC->myProp = 'C'; $doc->appendChild($nodeC); foreach ($doc->childNodes as $n) { echo 'Tag ', $n->tagName, ' myProp:', PHP_EOL; var_dump($n->myProp); } Expected result: ---------------- Tag a myProp: string(1) "A" Tag b myProp: string(1) "B" Tag c myProp: string(1) "C" Actual result: -------------- Tag a myProp: string(12) "Some default" Tag b myProp: string(1) "B" Tag c myProp: string(1) "C"