|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2011-01-04 14:27 UTC] aharvey@php.net
-Status: Open
+Status: Assigned
-Package: XML related
+Package: Documentation problem
-Assigned To:
+Assigned To: aharvey
[2011-01-04 14:27 UTC] aharvey@php.net
[2011-01-04 14:28 UTC] aharvey@php.net
-Type: Bug
+Type: Documentation Problem
[2011-01-04 14:28 UTC] aharvey@php.net
[2011-01-04 14:33 UTC] aharvey@php.net
[2011-01-04 14:33 UTC] aharvey@php.net
-Status: Assigned
+Status: Closed
[2011-01-04 14:33 UTC] aharvey@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Dec 07 09:00:02 2025 UTC |
Description: ------------ Apologies but I'm not running the SVN version as I only have hosting access to PHP, but I've searched through the bugs and have found nothing. Using 5.3.0, sorry if this has already been fixed. When using an XPath expression "/test/@attr1" to select one attribute, attributes() returns NULL when it should return the single attribute Test script: --------------- <?php $xml = simplexml_load_string("<test attr1=\"a\" attr2=\"b\"></test>"); $result = $xml->xpath("/test"); var_dump ($result[0]); //Prints attributes, all fine var_dump ($result[0]->attributes()); //Works fine $result = $xml->xpath("/test/@attr1"); var_dump ($result[0]); //Prints attribute "attr1", all fine var_dump ($result[0]->attributes()); //Should print same as above but returns null ?> Expected result: ---------------- The last var_dump should have printed the same as the previous var_dump Actual result: -------------- The last var_dump printed null