Bug #52521 [Opn->Dup]: self-referenced array is copied instead of referenced after serialization

From: Date: Sun, 01 Jan 2017 11:33:22 +0000
Subject: Bug #52521 [Opn->Dup]: self-referenced array is copied instead of referenced after serialization
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-206269@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=52521&edit=1 ID: 52521 Updated by: nikic@php.net Reported by: martin dot leucht at gmail dot com Summary: self-referenced array is copied instead of referenced after serialization -Status: Open +Status: Duplicate Type: Bug Package: Arrays related Operating System: WIN32 PHP Version: 5.3.3 Block user comment: N Private report: N New Comment: Marking as duplicate of the newer bug #62634, which contains a comment explaining why this happens. Previous Comments: ------------------------------------------------------------------------ [2010-08-05 16:18:58] martin dot leucht at gmail dot com // updated bug information ------------------------------------------------------------------------ [2010-08-04 22:50:22] martin dot leucht at googlemail dot com It seems it is array-related. The same thing using the stdclass works fine. Test script: ------------ <?php $Object = (object)array( 'a' => 1, 'b' => &$Object, ); print_r($Object); $Array = array( 'a' => 1, 'b' => &$Array, ); print_r($Array); $Array = unserialize(serialize($Array)); $Object = unserialize(serialize($Object)); $Object->b->a = 2; print_r($Object); $Array['b']['a'] = 2; print_r($Array); ?> Actual result: -------------- stdClass Object ( [a] => 1 [b] => stdClass Object *RECURSION* ) Array ( [a] => 1 [b] => Array ( [a] => 1 [b] => Array *RECURSION* ) ) stdClass Object ( [a] => 2 [b] => stdClass Object *RECURSION* ) Array ( [a] => 1 [b] => Array ( [a] => 2 [b] => Array *RECURSION* ) ) ------------------------------------------------------------------------ [2010-08-04 22:03:08] martin dot leucht at googlemail dot com Okay, I finally made it though. I setup a build environment, built the latest dev-version of PHP and ran the test script. But still: identical results. Please tell me how can I provide some help or assistence to solve this issue?! ------------------------------------------------------------------------ [2010-08-03 13:23:39] martin dot leucht at gmail dot com Sorry, but there are no builds on the Windows snapshots page and as I do not maintain a PHP build environment (nor am currently willing to do so due to a lack of time) I can not test it right now. Could you please give me a hint when the snapshot builds are available or if anyone else can do this test using the given test script above. ------------------------------------------------------------------------ [2010-08-03 09:53:39] mike@php.net Please try using this snapshot: http://snaps.php.net/php-trunk-latest.tar.gz For Windows: http://windows.php.net/snapshots/ Could you please try a trunk snapshot, IIRC this problem might be fixed already. Thanks. ------------------------------------------------------------------------ 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=52521 -- Edit this bug report at https://bugs.php.net/bug.php?id=52521&edit=1

« previous php.bugs (#206269) next »