[2004年08月03日 05:15 UTC] 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 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004年08月03日 05:23 UTC] lists at cyberlot dot net
[2004年08月03日 12:01 UTC] chregu@php.net
[2004年08月03日 15:29 UTC] lists at cyberlot dot net
[2004年08月03日 15:39 UTC] lists at cyberlot dot net
[2011年05月31日 11:22 UTC] stu at dyndev dot co dot nz
[2015年03月22日 02:07 UTC] perske at uni-muenster dot de
|