ID:               29500
 User updated by:  lists at cyberlot dot net
 Reported By:      lists at cyberlot dot net
 Status:           Wont fix
 Bug Type:         SimpleXML related
 Operating System: Fedora Core 2
 PHP Version:      5.0.0
 New Comment:

Ok it is impossible to modify the simpleobject once creating which
means you can't add anything to the xml.

Is this a desired affect as well?


Previous Comments:
------------------------------------------------------------------------

[2004-08-03 15:29:03] lists at cyberlot dot net

Im not signed up for that list...
The online docs badly need updating then.

1. To express the need to use typecasting depending on how you access
the variable.

2. That you can no longer "change" the simplexml object like explained
in example 7

------------------------------------------------------------------------

[2004-08-03 12:01:13] [EMAIL PROTECTED]

That's by design and was discussed on 
[EMAIL PROTECTED]

------------------------------------------------------------------------

[2004-08-03 05:23:22] lists at cyberlot dot net

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

------------------------------------------------------------------------

[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

Reply via email to