Edit report at https://bugs.php.net/bug.php?id=36424&edit=1

 ID:                 36424
 User updated by:    mastabog at hotmail dot com
 Reported by:        mastabog at hotmail dot com
 Summary:            Keeping reference info through recursive calls to
                     serialize()
 Status:             Closed
 Type:               Feature/Change Request
 Package:            Unknown/Other Function
 Operating System:   *
-PHP Version:        5.2.14-dev
+PHP Version:        5.3.8
 Assigned To:        mike
 Block user comment: N
 Private report:     N

 New Comment:

Wow! More than 5 and a half years since I discovered, reproduced and submitted 
this bug ...

To mike:

Why wait until 5.4? There are many web hosting providers that will delay the 
update to 5.4 for years but will instantly update to the next 5.3.x release. 
Most providers only just updated from 5.2 to 5.3 (i.e. this or last month) even 
though 5.3 has been out since 2009.

Couldn't you apply the patch to the next 5.3.x release instead?


Previous Comments:
------------------------------------------------------------------------
[2011-09-30 06:49:55] m...@php.net

The patch is contained in upcoming PHP-5.4

------------------------------------------------------------------------
[2010-12-10 12:40:13] peter at desk dot nl

I've just been bitten by this bug (in php 5.3.3), cost me half a day to figure 
it out... it's highly annoying because I can't go back to using __sleep and 
__wakeup without much rewriting, and while working around it is feasible, it's 
pretty hacky in my situation.

what has happened to the patch mentioned in may ? was it ever committed ?

------------------------------------------------------------------------
[2010-05-26 09:24:41] m...@php.net

Automatic comment from SVN on behalf of mike
Revision: http://svn.php.net/viewvc/?view=revision&revision=299770
Log: Added support for object references in recursive serialize() calls. FR 
#36424

------------------------------------------------------------------------
[2010-05-21 13:08:07] mastabog at hotmail dot com

I still don't understand why this is not seen as a bug. My example shows that 
without "implements Serializable" object references are honoured (as expected) 
while with "implements Serializable" object references are broken (which is 
unexpected).

Seeing you classified this as "feature request" makes me think that breaking 
object references was actually intended behaviour or that there is a way to 
maintain object references when implementing Serializable. Can you then please 
provide the body of the serialize() and unserialize() methods in class A in the 
example below that will maintain object references as expected, i.e. $new_oC->A 
=== $new_oC->B->A?

class A implements Serializable
{
        public function serialize ()
        {
                [...]
        }

        function unserialize($serialized)
        {
                [...]
        }
}

class B extends A
{
        public $A;
}

class C extends A
{
        public $A;
        public $B;
}

$oC = new C();
$oC->A = new A();
$oC->B = new B();
$oC->B->A = $oC->A;

echo $oC->A === $oC->B->A ? "yes" : "no", "\n"; 
$ser = serialize($oC);
$new_oC = unserialize($ser);
echo $new_oC->A === $new_oC->B->A ? "yes" : "no", "\n";

------------------------------------------------------------------------
[2010-05-21 11:19:54] m...@php.net

Reclassified as Change Request.

JFYI: http://news.php.net/php.internals/48369

------------------------------------------------------------------------


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

    https://bugs.php.net/bug.php?id=36424


-- 
Edit this bug report at https://bugs.php.net/bug.php?id=36424&edit=1

Reply via email to