Skip to content

Commit 04db570

Browse files
committed
- Fixed bug #62672 (Error on serialize of ArrayObject) patch by: lior dot k at zend dot com
1 parent 40c3601 commit 04db570

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

ext/spl/spl_array.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1778,7 +1778,7 @@ SPL_METHOD(Array, unserialize)
17781778
++p;
17791779

17801780
if (*p!='m') {
1781-
if (*p!='a' && *p!='O' && *p!='C') {
1781+
if (*p!='a' && *p!='O' && *p!='C' && *p!='r') {
17821782
goto outexcept;
17831783
}
17841784
intern->ar_flags &= ~SPL_ARRAY_CLONE_MASK;

ext/spl/tests/bug62672.phpt

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
--TEST--
2+
Bug #62672 (Error on serialize of ArrayObject)
3+
--FILE--
4+
<?php
5+
6+
class ObjA
7+
{
8+
private $_varA;
9+
10+
public function __construct(Iterator $source)
11+
{
12+
$this->_varA = $source;
13+
}
14+
}
15+
16+
class ObjB extends ObjA
17+
{
18+
private $_varB;
19+
20+
public function __construct(ArrayObject $keys)
21+
{
22+
$this->_varB = $keys;
23+
parent::__construct($keys->getIterator());
24+
}
25+
}
26+
27+
$obj = new ObjB(new ArrayObject());
28+
29+
var_dump($obj == unserialize(serialize($obj)));
30+
--EXPECTF--
31+
bool(true)

0 commit comments

Comments
 (0)