|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2016-08-30 08:57 UTC] nikic@php.net
[2016-08-30 08:57 UTC] nikic@php.net
-Status: Open
+Status: Closed
[2016-10-17 10:08 UTC] bwoebi@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 00:00:02 2025 UTC |
Description: ------------ isset() and unset() on SimpleXML properties do not take the element namespace into account. isset() returns true if there is an element with that name in *any* namespace and unset() removes the property from *all* namespaces. Test script: --------------- <?php $xml = new SimpleXMLElement('<root xmlns:ns="ns"><foo>bar</foo><ns:foo>ns:bar</ns:foo><ns:foo2>ns:bar2</ns:foo2></root>'); var_dump(isset($xml->foo2)); unset($xml->foo); var_dump($xml->children('ns')); Expected result: ---------------- bool(false) object(SimpleXMLElement)#2 (2) { ["foo"]=> string(6) "ns:bar" ["foo2"]=> string(7) "ns:bar2" } Actual result: -------------- bool(true) object(SimpleXMLElement)#2 (1) { ["foo2"]=> string(7) "ns:bar2" }