|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2001-05-29 08:17 UTC] maverick at wallstreet-develop dot de
Here is the smallest programm I could make to reproduce the problem.
<?
$a[0][0]="Ape1";
$a[1][0]="Ape2";
$a[0][one]=&$a[0][0];
$a[1][two]=&$a[1][0];
$wrong_a=unserialize( serialize ( $a) );
echo "Wrong:\n";
print_r( $wrong_a );
echo "Right:\n";
print_r( $a );
?>
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Nov 04 19:00:02 2025 UTC |
I'm afraid I just don't see the "bug" here. On my machine, this shows: Wrong: Array ( [0] => Array ( [0] => Ape1 [one] => Ape1 ) [1] => Array ( [0] => Ape2 [two] => Ape2 ) ) Right: Array ( [0] => Array ( [0] => Ape1 [one] => Ape1 ) [1] => Array ( [0] => Ape2 [two] => Ape2 ) ) What's the problem?Well... I thought serialize couldn't handle references at all... but it can (the manual confirms that). So it's not a feature request. But there IS a bug seomwhere... look at the following output made with PHP-4.0.6 (tested on Windows 2000 and Debian Linux): Wrong: Array ( [0] => Array ( [0] => Ape1 [one] => Ape1 ) [1] => Array ( [0] => Ape2 [two] => Array *RECURSION* ) ) Right: Array ( [0] => Array ( [0] => Ape1 [one] => Ape1 ) [1] => Array ( [0] => Ape2 [two] => Ape2 ) ) print_r($wrong_a[1][two]); results in: Array ( [0] => Ape2 [two] => Array ( [0] => Ape2 [two] => Array ( [0] => Ape2 [two] => Array *RECURSION* ) ) )