summaryrefslogtreecommitdiff
path: root/ext/spl
diff options
context:
space:
mode:
authorChristoph M. Becker <cmbecker69@gmx.de>2017-09-20 15:48:24 +0200
committerChristoph M. Becker <cmbecker69@gmx.de>2017-09-20 15:54:07 +0200
commit43152bc39f0221498fd35819569e54f3565a8822 (patch)
tree4a2d23ae383644784b1c32e1b66b846d88e9f623 /ext/spl
parent6544ec5460d16ba48c1430bc59ae6475b4362686 (diff)
parent0c0b955d5f7b1ec19cc303035e194da58c632336 (diff)
downloadphp-git-43152bc39f0221498fd35819569e54f3565a8822.tar.gz
Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1: Fixed bug #73629 (SplDoublyLinkedList::setIteratorMode masks intern flags)
Diffstat (limited to 'ext/spl')
-rw-r--r--ext/spl/spl_dllist.c2
-rw-r--r--ext/spl/tests/bug73629.phpt20
2 files changed, 21 insertions, 1 deletions
diff --git a/ext/spl/spl_dllist.c b/ext/spl/spl_dllist.c
index 667a6bad7b..52138561bc 100644
--- a/ext/spl/spl_dllist.c
+++ b/ext/spl/spl_dllist.c
@@ -733,7 +733,7 @@ SPL_METHOD(SplDoublyLinkedList, setIteratorMode)
return;
}
- intern->flags = value & SPL_DLLIST_IT_MASK;
+ intern->flags = value & SPL_DLLIST_IT_MASK | intern->flags & SPL_DLLIST_IT_FIX;
RETURN_LONG(intern->flags);
}
diff --git a/ext/spl/tests/bug73629.phpt b/ext/spl/tests/bug73629.phpt
new file mode 100644
index 0000000000..5b6587c685
--- /dev/null
+++ b/ext/spl/tests/bug73629.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Bug #73629 (SplDoublyLinkedList::setIteratorMode masks intern flags)
+--FILE--
+<?php
+$q = new SplQueue();
+try {
+ $q->setIteratorMode(SplDoublyLinkedList::IT_MODE_FIFO);
+} catch (Exception $e) {
+ echo 'unexpected exception: ' . $e->getMessage() . "\n";
+}
+try {
+ $q->setIteratorMode(SplDoublyLinkedList::IT_MODE_LIFO);
+} catch (Exception $e) {
+ echo 'expected exception: ' . $e->getMessage() . "\n";
+}
+?>
+===DONE===
+--EXPECTF--
+expected exception: Iterators' LIFO/FIFO modes for SplStack/SplQueue objects are frozen
+===DONE===