php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28152 simplexml object could not be unserialized
Submitted: 2004-04-26 08:17 UTC Modified: 2004-04-26 08:44 UTC
From: gyumee at dreamwiz dot com Assigned:
Status: Not a bug Package: SimpleXML related
PHP Version: 5.0.0RC1 OS: debian gnu/linux sid
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: gyumee at dreamwiz dot com
New email:
PHP Version: OS:

 

 [2004-04-26 08:17 UTC] gyumee at dreamwiz dot com
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:{}


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-04-26 08:44 UTC] derick@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

Searching the bug database first helps too to find that it\'s bogus.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 18:01:29 2024 UTC