summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS2
-rwxr-xr-xext/spl/spl_array.c2
-rw-r--r--ext/spl/tests/array_025.phpt40
3 files changed, 43 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 7bf8e254dd..c3f2f650aa 100644
--- a/NEWS
+++ b/NEWS
@@ -35,6 +35,8 @@ PHP NEWS
- Fixed bug #45392 (ob_start()/ob_end_clean() and memory_limit). (Ilia)
- Fixed bug #45382 (timeout bug in stream_socket_enable_crypto).
(vnegrier at optilian dot com, Ilia)
+- Fixed bug #46192 (ArrayObject with objects as storage serialization).
+ (Etienne)
02 Sep 2008, PHP 5.3.0 Alpha 2
- Removed special treatment of "/tmp" in sessions for open_basedir.
diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c
index fd1fb0759b..90d46859e3 100755
--- a/ext/spl/spl_array.c
+++ b/ext/spl/spl_array.c
@@ -1593,7 +1593,7 @@ void spl_array_unserialize_helper(spl_array_object *intern, const unsigned char
++p;
if (*p!='m') {
- if (*p!='a') {
+ if (*p!='a' && *p!='O' && *p!='C') {
goto outexcept;
}
intern->ar_flags &= ~SPL_ARRAY_CLONE_MASK;
diff --git a/ext/spl/tests/array_025.phpt b/ext/spl/tests/array_025.phpt
new file mode 100644
index 0000000000..35893ea1ea
--- /dev/null
+++ b/ext/spl/tests/array_025.phpt
@@ -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
+ )
+
+ )
+
+)