From:             walshes at gmail dot com
Operating system: Linux
PHP version:      5.2.8
PHP Bug Type:     SimpleXML related
Bug description:  Trouble with CDATA for single (not multiple) elements

Description:
------------
The example below fails to run right.  If there are 2 'CueID' elements, it
works.  If there are 1 or 2 non-CDATA CueID elements, it also works.

Reproduce code:
---------------
$raw_xml =
'<TopLevel><Cues><CueID><![CDATA[123]]></CueID></Cues></TopLevel>';
$xml = @new SimpleXMLElement($raw_xml);
$cues = (array)$xml->Cues;
$cues = (array)$cues['CueID'];

if ($cues)
{  foreach ($cues as $c)
   {  echo "got $c<BR>";
   }
}
else
{  echo "SHE BROKE!";
}

Expected result:
----------------
Should print
123

Actual result:
--------------
SHE BROKE is printed 

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

Reply via email to