Skip to content

Commit b761997

Browse files
committed
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3: Fix #75673: SplStack::unserialize() behavior
2 parents 04c9c4a + b842772 commit b761997

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

NEWS

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
33

4+
?? ??? ????, PHP 7.4.5
5+
6+
- Spl:
7+
. Fixed bug #75673 (SplStack::unserialize() behavior). (cmb)
8+
49
?? ??? ????, PHP 7.4.4
510

611
- Core:

ext/spl/spl_dllist.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,6 +1185,12 @@ SPL_METHOD(SplDoublyLinkedList, unserialize)
11851185
return;
11861186
}
11871187

1188+
while (intern->llist->count > 0) {
1189+
zval tmp;
1190+
spl_ptr_llist_pop(intern->llist, &tmp);
1191+
zval_ptr_dtor(&tmp);
1192+
}
1193+
11881194
s = p = (const unsigned char*)buf;
11891195
PHP_VAR_UNSERIALIZE_INIT(var_hash);
11901196

ext/spl/tests/bug75673.phpt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
--TEST--
2+
Bug #75673 (SplStack::unserialize() behavior)
3+
--FILE--
4+
<?php
5+
$stack = new SplStack();
6+
$stack->push("one");
7+
$stack->push("two");
8+
9+
$serialized = $stack->serialize();
10+
var_dump($stack->count());
11+
$stack->unserialize($serialized);
12+
var_dump($stack->count());
13+
$stack->unserialize($serialized);
14+
var_dump($stack->count());
15+
?>
16+
--EXPECT--
17+
int(2)
18+
int(2)
19+
int(2)

0 commit comments

Comments
 (0)