Bug #61110 [Opn->Nab]: The same codes output the different results between ver5.3.8 & ver5.3.10

From: Date: Fri, 17 Feb 2012 00:53:13 +0000
Subject: Bug #61110 [Opn->Nab]: The same codes output the different results between ver5.3.8 & ver5.3.10
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-167585@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=61110&edit=1 ID: 61110 Updated by: aharvey@php.net Reported by: tansuanna at gmail dot com Summary: The same codes output the different results between ver5.3.8 & ver5.3.10 -Status: Open +Status: Not a bug Type: Bug -Package: Output Control +Package: Class/Object related Operating System: CentOS 5.5 PHP Version: 5.3.10 Block user comment: N Private report: N New Comment: This came about as a result of the fix for bug #55798 in 5.3.9. At some point, we've just got to pick a behaviour and stick with it: the new behaviour at least makes the unserialised properties accessible, which is better than the old. Previous Comments: ------------------------------------------------------------------------ [2012-02-16 17:58:49] tansuanna at gmail dot com Description: ------------ The same codes output the different results between ver5.3.8 & ver5.3.10: <?php $a = serialize((object)array( ’1′ => ‘aaa’, ’2′ => ‘bbb’, ’3′ => ‘ccc’, )); $a = (array)unserialize($a); $a[1] = ‘ddd’; var_dump($a); ?> // results before ver5.3.8: array(3) { [1]=> string(3) “ddd” [2]=> string(3) “bbb” [3]=> string(3) “ccc” } // results in ver5.3.10: array(4) { ["1"]=> string(3) “aaa” ["2"]=> string(3) “bbb” ["3"]=> string(3) “ccc” [1]=> string(3) “ddd” } Test script: --------------- <?php $a = serialize((object)array( ’1′ => ‘aaa’, ’2′ => ‘bbb’, ’3′ => ‘ccc’, )); $a = (array)unserialize($a); $a[1] = ‘ddd’; var_dump($a); ?> Expected result: ---------------- output same results in their versions: array(3) { [1]=> string(3) “ddd” [2]=> string(3) “bbb” [3]=> string(3) “ccc” } Actual result: -------------- // results before ver5.3.8: array(3) { [1]=> string(3) “ddd” [2]=> string(3) “bbb” [3]=> string(3) “ccc” } // results in ver5.3.10: array(4) { ["1"]=> string(3) “aaa” ["2"]=> string(3) “bbb” ["3"]=> string(3) “ccc” [1]=> string(3) “ddd” } ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=61110&edit=1

« previous php.bugs (#167585) next »