From:             
Operating system: Linux
PHP version:      5.4.0
Package:          SimpleXML related
Bug Type:         Bug
Bug description:Access to "naked" node returns wrong truth value

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


-- 
Edit bug report at https://bugs.php.net/bug.php?id=61335&edit=1
-- 
Try a snapshot (PHP 5.4):            
https://bugs.php.net/fix.php?id=61335&r=trysnapshot54
Try a snapshot (PHP 5.3):            
https://bugs.php.net/fix.php?id=61335&r=trysnapshot53
Try a snapshot (trunk):              
https://bugs.php.net/fix.php?id=61335&r=trysnapshottrunk
Fixed in SVN:                        
https://bugs.php.net/fix.php?id=61335&r=fixed
Fixed in SVN and need be documented: 
https://bugs.php.net/fix.php?id=61335&r=needdocs
Fixed in release:                    
https://bugs.php.net/fix.php?id=61335&r=alreadyfixed
Need backtrace:                      
https://bugs.php.net/fix.php?id=61335&r=needtrace
Need Reproduce Script:               
https://bugs.php.net/fix.php?id=61335&r=needscript
Try newer version:                   
https://bugs.php.net/fix.php?id=61335&r=oldversion
Not developer issue:                 
https://bugs.php.net/fix.php?id=61335&r=support
Expected behavior:                   
https://bugs.php.net/fix.php?id=61335&r=notwrong
Not enough info:                     
https://bugs.php.net/fix.php?id=61335&r=notenoughinfo
Submitted twice:                     
https://bugs.php.net/fix.php?id=61335&r=submittedtwice
register_globals:                    
https://bugs.php.net/fix.php?id=61335&r=globals
PHP 4 support discontinued:          
https://bugs.php.net/fix.php?id=61335&r=php4
Daylight Savings:                    https://bugs.php.net/fix.php?id=61335&r=dst
IIS Stability:                       
https://bugs.php.net/fix.php?id=61335&r=isapi
Install GNU Sed:                     
https://bugs.php.net/fix.php?id=61335&r=gnused
Floating point limitations:          
https://bugs.php.net/fix.php?id=61335&r=float
No Zend Extensions:                  
https://bugs.php.net/fix.php?id=61335&r=nozend
MySQL Configuration Error:           
https://bugs.php.net/fix.php?id=61335&r=mysqlcfg

Reply via email to