From:             gyumee at dreamwiz dot com
Operating system: debian gnu/linux sid
PHP version:      5.0.0RC1
PHP Bug Type:     SimpleXML related
Bug description:  simplexml object could not be unserialized

Description:
------------
I want to cache the object returned by simplexml_load_string() or
simplexml_load_file().
Fisrt, I seriaize the object and save it into file.
And I read saved string and try to unserialize it.
But PHP not handle it collectly.

Reproduce code:
---------------
<?
    $data = <<<XML
<?xml version='1.0' standalone='yes'?>
<movies>
    <movie>
        <title>PHP: Behind the Parser</title>
    </movie>
</movies>
XML;
    $xml = simplexml_load_string($data);
    $str = serialize($xml);
    echo "$str\n";
    $new_xml = unserialize($str);
    echo serialize($new_xml)."\n";
?>


Expected result:
----------------
O:17:"simplexml_element":1:{s:5:"movie";O:17:"simplexml_element":1:{s:5:"title";s:22:"PHP:
Behind the Parser";}}
O:17:"simplexml_element":1:{s:5:"movie";O:17:"simplexml_element":1:{s:5:"title";s:22:"PHP:
Behind the Parser";}}


Actual result:
--------------
O:17:"simplexml_element":1:{s:5:"movie";O:17:"simplexml_element":1:{s:5:"title";s:22:"PHP:
Behind the Parser";}}
 
Warning: Node no longer exists in
/home/gen128/project/mogaha_2004/docs/08_devel/02_research/php-xml/simplexml_performance/test_serialize_xml.php
on line 13
 
Warning: Node no longer exists in
/home/gen128/project/mogaha_2004/docs/08_devel/02_research/php-xml/simplexml_performance/test_serialize_xml.php
on line 13
 
Warning: Node no longer exists in
/home/gen128/project/mogaha_2004/docs/08_devel/02_research/php-xml/simplexml_performance/test_serialize_xml.php
on line 14
O:17:"simplexml_element":0:{}


-- 
Edit bug report at http://bugs.php.net/?id=28152&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=28152&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=28152&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=28152&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=28152&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=28152&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=28152&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=28152&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=28152&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=28152&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=28152&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=28152&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=28152&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28152&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=28152&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=28152&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=28152&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=28152&r=float

Reply via email to