summaryrefslogtreecommitdiff
path: root/ext/spl
diff options
context:
space:
mode:
authorChristoph M. Becker <cmbecker69@gmx.de>2020-03-06 09:12:03 +0100
committerChristoph M. Becker <cmbecker69@gmx.de>2020-03-06 09:12:03 +0100
commitf3c24ec26520e886c41227a6dbc5f4f27827bc52 (patch)
treea73dd521648e09c1c7bd8db73048d4d4db803580 /ext/spl
parent0d913f9acf821f4d3074ac457b93d7c478edbcc5 (diff)
parentb761997de37edf72a6b7f7d458f6503a00c9edb7 (diff)
downloadphp-git-f3c24ec26520e886c41227a6dbc5f4f27827bc52.tar.gz
Merge branch 'PHP-7.4'
* PHP-7.4: Fix #75673: SplStack::unserialize() behavior
Diffstat (limited to 'ext/spl')
-rw-r--r--ext/spl/spl_dllist.c6
-rw-r--r--ext/spl/tests/bug75673.phpt19
2 files changed, 25 insertions, 0 deletions
diff --git a/ext/spl/spl_dllist.c b/ext/spl/spl_dllist.c
index 17c7eca665..9b9ef4cadd 100644
--- a/ext/spl/spl_dllist.c
+++ b/ext/spl/spl_dllist.c
@@ -1180,6 +1180,12 @@ SPL_METHOD(SplDoublyLinkedList, unserialize)
return;
}
+ while (intern->llist->count > 0) {
+ zval tmp;
+ spl_ptr_llist_pop(intern->llist, &tmp);
+ zval_ptr_dtor(&tmp);
+ }
+
s = p = (const unsigned char*)buf;
PHP_VAR_UNSERIALIZE_INIT(var_hash);
diff --git a/ext/spl/tests/bug75673.phpt b/ext/spl/tests/bug75673.phpt
new file mode 100644
index 0000000000..76fe3745fb
--- /dev/null
+++ b/ext/spl/tests/bug75673.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Bug #75673 (SplStack::unserialize() behavior)
+--FILE--
+<?php
+$stack = new SplStack();
+$stack->push("one");
+$stack->push("two");
+
+$serialized = $stack->serialize();
+var_dump($stack->count());
+$stack->unserialize($serialized);
+var_dump($stack->count());
+$stack->unserialize($serialized);
+var_dump($stack->count());
+?>
+--EXPECT--
+int(2)
+int(2)
+int(2)