Bug #61042 [Opn->Dup]: unserialize issue
Edit report at https://bugs.php.net/bug.php?id=61042&edit=1
ID: 61042
Updated by: cataphract@php.net
Reported by: vigano dot n at clxeurope dot com
Summary: unserialize issue
-Status: Open
+Status: Duplicate
Type: Bug
Package: Arrays related
Operating System: Linux Centos
PHP Version: 5.3.10
Block user comment: N
Private report: N
New Comment:
The bug is not in unserialize; the object is correctly unserialized, with the rule that objects only
have string properties correctly enforced (this was not enforced before 5.3.9 though: see bug
#55798). The problem is that these strings are not converted to numbers when casting to an array.
This is a known problem and unfortunately the main opinion seems to be this ought not to be fixed
due to performance issues.
Previous Comments:
------------------------------------------------------------------------
[2012-02-10 11:47:47] vigano dot n at clxeurope dot com
Description:
------------
It seems that, using PHP 5.3.9/10, an unserialized object is not properly cast to array.
Test script:
---------------
The following code gives different results using PHP 5.3.8 and PHP 5.3.9/10:
$arr = (object)array("value");
$uns = (array)unserialize(serialize($arr));
var_dump($uns);
var_dump(isset($uns[0]));
Expected result:
----------------
Using PHP 5.3.8:
array(1) { [0]=> string(5) "value" } bool(true)
Actual result:
--------------
Using PHP 5.3.9/10:
array(1) { ["0"]=> string(5) "value" } bool(false)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=61042&edit=1
Thread (8 messages)