summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/spl/spl_array.c2
-rw-r--r--ext/spl/tests/bug62672.phpt31
2 files changed, 32 insertions, 1 deletions
diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c
index 2c2c87d027..40fbb4c8f6 100644
--- a/ext/spl/spl_array.c
+++ b/ext/spl/spl_array.c
@@ -1778,7 +1778,7 @@ SPL_METHOD(Array, unserialize)
++p;
if (*p!='m') {
- if (*p!='a' && *p!='O' && *p!='C') {
+ if (*p!='a' && *p!='O' && *p!='C' && *p!='r') {
goto outexcept;
}
intern->ar_flags &= ~SPL_ARRAY_CLONE_MASK;
diff --git a/ext/spl/tests/bug62672.phpt b/ext/spl/tests/bug62672.phpt
new file mode 100644
index 0000000000..d0d6a62451
--- /dev/null
+++ b/ext/spl/tests/bug62672.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Bug #62672 (Error on serialize of ArrayObject)
+--FILE--
+<?php
+
+class ObjA
+{
+ private $_varA;
+
+ public function __construct(Iterator $source)
+ {
+ $this->_varA = $source;
+ }
+}
+
+class ObjB extends ObjA
+{
+ private $_varB;
+
+ public function __construct(ArrayObject $keys)
+ {
+ $this->_varB = $keys;
+ parent::__construct($keys->getIterator());
+ }
+}
+
+$obj = new ObjB(new ArrayObject());
+
+var_dump($obj == unserialize(serialize($obj)));
+--EXPECTF--
+bool(true)