|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2011-01-01 00:34 UTC] jani@php.net
-Status: Open
+Status: Bogus
-Package: Feature/Change Request
+Package: *General Issues
[2011-01-01 00:34 UTC] jani@php.net
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Dec 07 23:00:02 2025 UTC |
Not sure if this is a bug but serialize() cannot work with arrays that holds elements which points to the array itself <?php $b=array(1,2,4); $b[]=&$b; $str=serialize($b); var_dump($b); var_dump($str); $c=unserialize($str); var_dump($c); ?> The ouput is: array(4) { [0]=> int(1) [1]=> int(2) [2]=> int(4) [3]=> *RECURSION* } string(64) "a:4:{i:0;i:1;i:1;i:2;i:2;i:4;i:3;a:4:{i:0;i:1;i:1;i:2;i:2;i:4;}}" bool(false) If $b[]=&$b; removed the output is: array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(4) } string(30) "a:3:{i:0;i:1;i:1;i:2;i:2;i:4;}" array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(4) } That's ok. Serialize() have either to check against recursion or encode somehow the recursion in the serialized(great BC impact).