mirror of
https://github.com/php/php-src.git
synced 2025-08-19 17:04:47 +02:00
Fix #46192 (Serialization of ArrayObject with objects as storage)
This commit is contained in:
parent
3b3112c2b6
commit
41493606e6
2 changed files with 41 additions and 1 deletions
|
@ -1594,7 +1594,7 @@ void spl_array_unserialize_helper(spl_array_object *intern, const unsigned char
|
||||||
++p;
|
++p;
|
||||||
|
|
||||||
if (*p!='m') {
|
if (*p!='m') {
|
||||||
if (*p!='a') {
|
if (*p!='a' && *p!='O' && *p!='C') {
|
||||||
goto outexcept;
|
goto outexcept;
|
||||||
}
|
}
|
||||||
intern->ar_flags &= ~SPL_ARRAY_CLONE_MASK;
|
intern->ar_flags &= ~SPL_ARRAY_CLONE_MASK;
|
||||||
|
|
40
ext/spl/tests/array_025.phpt
Normal file
40
ext/spl/tests/array_025.phpt
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
--TEST--
|
||||||
|
SPL: ArrayObject serialize with an object as storage
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
$obj1 = new ArrayObject(new ArrayObject(array(1,2)));
|
||||||
|
$s = serialize($obj1);
|
||||||
|
$obj2 = unserialize($s);
|
||||||
|
|
||||||
|
print_r($obj1);
|
||||||
|
echo "$s\n";
|
||||||
|
print_r($obj2);
|
||||||
|
?>
|
||||||
|
--EXPECT--
|
||||||
|
ArrayObject Object
|
||||||
|
(
|
||||||
|
[storage:ArrayObject:private] => ArrayObject Object
|
||||||
|
(
|
||||||
|
[storage:ArrayObject:private] => Array
|
||||||
|
(
|
||||||
|
[0] => 1
|
||||||
|
[1] => 2
|
||||||
|
)
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
)
|
||||||
|
C:11:"ArrayObject":76:{x:i:0;C:11:"ArrayObject":37:{x:i:0;a:2:{i:0;i:1;i:1;i:2;};m:a:0:{}};m:a:0:{}}
|
||||||
|
ArrayObject Object
|
||||||
|
(
|
||||||
|
[storage:ArrayObject:private] => ArrayObject Object
|
||||||
|
(
|
||||||
|
[storage:ArrayObject:private] => Array
|
||||||
|
(
|
||||||
|
[0] => 1
|
||||||
|
[1] => 2
|
||||||
|
)
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
)
|
Loading…
Add table
Add a link
Reference in a new issue