summaryrefslogtreecommitdiff
path: root/ext/spl
diff options
context:
space:
mode:
authorFelipe Pena <felipensp@gmail.com>2013-06-25 21:18:09 -0300
committerFelipe Pena <felipensp@gmail.com>2013-06-25 21:18:09 -0300
commit04db57066deb73ef9c960a2c5bebad49195bc1bb (patch)
tree3d93c54e1d302a3bb8e17f216c6468f3ee3ffb40 /ext/spl
parent40c360194745ad09f066e6a1798d8c18dcdb58f4 (diff)
downloadphp-git-04db57066deb73ef9c960a2c5bebad49195bc1bb.tar.gz
- Fixed bug #62672 (Error on serialize of ArrayObject) patch by: lior dot k at zend dot com
Diffstat (limited to 'ext/spl')
-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)