Bug #14266 Updated: serialize() doesn't work correcty
| From: | lenar at vision dot ee | Date: | Wed, 28 Nov 2001 14:06:40 +0000 |
| Subject: | Bug #14266 Updated: serialize() doesn't work correcty | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-71929@lists.php.net to get a copy of this message | ||
ID: 14266
User updated by: lenar@vision.ee
Reported By: lenar@vision.ee
Status: Bogus
Bug Type: Scripting Engine problem
Operating System: Debian Linux
PHP Version: 4.2.0-dev
New Comment:
Ok, I tested a little bit more
and found that when calling serialize() like serialize(&$x)
it works.
I know about leaks, but those leaks don't kill me (yet).
And btw. Circular references work as expected. There is
nothing so "undefined" about them in php. They work quite
logically.
Previous Comments:
------------------------------------------------------------------------
[2001-11-28 09:01:05] zimt@php.net
sorry, i wanted to write:
you realy should *NOT*...
------------------------------------------------------------------------
[2001-11-28 08:59:04] zimt@php.net
Behaviour of Circular / Selfreferencing objects is not defined.
you could try to do a workarround
by using defining __sleep() and __wakeup()
in your class, which are called when the object is serialized / unserialized, and could unset those
self-references.
but you realy should do those.. if you dont destroy all of those references, you will get memory
leaks!
regards, Peter Petermann
------------------------------------------------------------------------
[2001-11-28 08:43:47] lenar@vision.ee
I dont' agree. Circular refferences can happen with
objects (using refferences). Sometimes they are
intentional. And serialize() doesn't completely ignore
this. Because it spits out:
O:8:"stdClass":1:{s:1:"x";O:8:"stdClass":1:{s:1:"x";R:2;}}
so it knows about circular refferences.
Now is there any reason why it doesn't generate instead
something like this:
O:8:"stdClass":1:{s:1:"x";R:1;}
I would understand if it completely ignores circular
references, but it doesn't. It just misbehaves.
------------------------------------------------------------------------
[2001-11-28 08:41:04] jmoore@php.net
Your creating a reference to itself this is not allowed.
Therefore the bug is bogus, the behaviour is undefined.
- James
------------------------------------------------------------------------
[2001-11-28 08:38:38] lenar@vision.ee
Tested this with current cvs too. No better luck.
Original and unserialized objects have different
representation in memory.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/?id=14266
Edit this bug report at http://bugs.php.net/?id=14266&edit=1