php.net |  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
Votes:1
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
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
26 + 28 = ?
Subscribe to this entry?

 
 [2005-05-08 04:01 UTC] a_wizzard at hotmail dot com
Description:
------------
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:
http://sportlaan.adsl.utwente.nl/webstorage/index.php

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:
http://sportlaan.adsl.utwente.nl/webstorage/index.php?clear=1

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:
http://bugs.php.net/bug.php?id=27120
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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-05-08 04:37 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.0-win32-latest.zip


 [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] tony2001@php.net
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-2022 The PHP Group
All rights reserved.
Last updated: Fri Dec 09 00:05:53 2022 UTC