|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32976 (Un)serialize destroys references in a tree like class structure
Submitted: 2005-05-08 04:01 UTC Modified: 2005-05-20 01:00 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: a_wizzard at hotmail dot com Assigned:
Status: No Feedback Package: Scripting Engine problem
PHP Version: 5.0.4 OS: Gentoo Linux 2.6
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: a_wizzard at hotmail dot com
New email:
PHP Version: OS:


 [2005-05-08 04:01 UTC] a_wizzard at hotmail dot com
When designing a file browser I discovered the PHP 5 does not handle the unserialization of references correctly. I'm using a tree like structure in which every node has a reference to its parents and its children. When deserializing, the reference becomes corrupted (or rather it disappears).

Look at the url below:

The first time a session is created with the default tree, notice that the nodes link to eachother. When you click on the upload link at the left directory tree (below the debug output) you'll see the script stops with an error complaining about its parent not being an object.
This should be the exact same structure as when starting the script.

Btw, kill the session using:

I've tested the code on the PHP 4.3.*something* engine as well and that one handles it perfectly - the references are restored using the serialize and unserialize calls.

Btw, I saw the bug report on:
This seems (by description) pretty much the same bug as reported before - what puzzles me though is that the old bug is from the old PHP5 CVS version whereas I am already using the stable 5.0.4. So its either not the same bug or the bug reappeared again...

Reproduce code:
See description

Expected result:
See description

Actual result:
See description


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-05-08 04:37 UTC]
Please try using this CVS snapshot:
For Windows:

 [2005-05-12 02:10 UTC] a_wizzard at hotmail dot com
I've tried to insert the CVS version last night and I think after a lot of tinkering I managed to get it running - same bug. Whatever I try, the references are gone and do not come back after unserializing thus rendering the recovered tree next to useless...

Mind you, I only have a production machine over here so I'm not to eager to rip out a working module from Apache - it can break at any time.

I'm hoping someone else will run into this and might provide additional info. For the moment I reverted the server back to PHP 4.

When I find the time I'll try to set up a spare server and test CVS releases.

Btw would it really be that hard to fix? I mean the same works in PHP 4 fine and looking at the string serialize generates I can't imagine that fixing this would be a huge problem (although an annoying one while its not fixed)...
 [2005-05-12 10:22 UTC]
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc.

If possible, make the script source available online and provide
an URL to it here. Try to avoid embedding huge scripts into the report.

 [2005-05-20 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Feb 27 23:01:27 2024 UTC