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

 ID:                 61110
 Comment by:         tansuanna at gmail dot com
 Reported by:        tansuanna at gmail dot com
 Summary:            The same codes output the different results between
                     ver5.3.8 & ver5.3.10
 Status:             Not a bug
 Type:               Bug
 Package:            Class/Object related
 Operating System:   CentOS 5.5
 PHP Version:        5.3.10
 Block user comment: N
 Private report:     N

 New Comment:

but i cant get the values:
var_dump(isset($a[2])); // false
var_dump(isset($a['2'])); // false

$id = strval(2);
var_dump(isset($a[$id])); // false


Previous Comments:
------------------------------------------------------------------------
[2012-02-17 00:53:13] ahar...@php.net

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.

------------------------------------------------------------------------
[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

Reply via email to