ID: 29500 User updated by: lists at cyberlot dot net Reported By: lists at cyberlot dot net Status: Open Bug Type: SimpleXML related Operating System: Fedora Core 2 PHP Version: 5.0.0 New Comment:
http://us3.php.net/manual/en/ref.simplexml.php In trying to get this working I played with the examples from this page. Example 7 returns the following error Fatal error: Objects used as arrays in post/pre increment/decrement must return values by reference in /root/test.php on line 29 Previous Comments: ------------------------------------------------------------------------ [2004-08-03 05:15:42] lists at cyberlot dot net Description: ------------ When using simplexml to access a element the returned object it returns a object instead of a string Have to type cast it as a (string) to get the information back, Should not have to typecast. If a typecast is required it should be specificed in the docs. Reproduce code: --------------- $string = <<<XML <?xml version='1.0'?> <document> <cmd>login</cmd> <login>Richard</login> </document> XML; $xml = simplexml_load_string($string); print_r($xml); $login = $xml->login; print_r($login); $login = (string) $xml->login; print_r($login); Expected result: ---------------- SimpleXMLElement Object ( [cmd] => login [login] => Richard ) Richard Richard Actual result: -------------- SimpleXMLElement Object ( [cmd] => login [login] => Richard ) SimpleXMLElement Object ( [0] => Richard ) Richard ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=29500&edit=1