|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2012-03-09 18:00 UTC] mueller at relog dot ch
-Summary: Access to "naked" node returns wrong truth value
+Summary: Access to array node returns wrong truth value
[2012-03-09 18:00 UTC] mueller at relog dot ch
[2012-03-10 00:00 UTC] me at ktamura dot com
[2012-03-13 13:19 UTC] mueller at relog dot ch
[2012-03-13 13:50 UTC] cschneid at cschneid dot com
[2015-05-26 19:28 UTC] cmb@php.net
-Status: Open
+Status: Verified
[2015-05-26 19:28 UTC] cmb@php.net
[2015-05-26 19:57 UTC] cmb@php.net
[2015-05-27 17:51 UTC] cmb@php.net
-Status: Verified
+Status: Duplicate
-Assigned To:
+Assigned To: cmb
[2015-05-27 17:51 UTC] cmb@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 15:00:01 2025 UTC |
Description: ------------ When accessing a simplexml node as array, I always get an empty simplexml object. If I cast the node to string, the behaviour is correct. If the parent node contains nothing but the child node (not even a newline) then the behaviour is also correct. Under php 5.3, the behaviour is correct. Test script: --------------- $rec1 = simplexml_load_string("<foo><bar>aa</bar>\n</foo>"); $rec2 = simplexml_load_string("<foo><bar>aa</bar></foo>"); if ($rec1->bar[0]) echo "NONEMPTY1\n"; # not reached, bug if ($rec1->bar[0] . "") echo "NONEMPTY2\n"; # correct if ($rec2->bar[0]) echo "NONEMPTY3\n"; # correct Expected result: ---------------- NONEMPTY1 NONEMPTY2 NONEMPTY3 Actual result: -------------- NONEMPTY2 NONEMPTY3