Patch fix-iterator-mask.patch for SPL related Bug #73629
Patch version 2016-11-30 15:50 UTC
Return to Bug #73629 |
Download this patch
Patch Revisions:
Developer: j.jeising@gmail.com
diff --git a/ext/spl/spl_dllist.c b/ext/spl/spl_dllist.c
index f8408b7..7b62018 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_MASK);
RETURN_LONG(intern->flags);
}
diff --git a/ext/spl/tests/bugXXXXX.phpt b/ext/spl/tests/bugXXXXX.phpt
new file mode 100644
index 0000000..f179515
--- /dev/null
+++ b/ext/spl/tests/bugXXXXX.phpt
@@ -0,0 +1,21 @@
+--TEST--
+SPL: DoublyLinkedList: iterator modes with internal flags
+--FILE--
+<?php
+$q = new SplQueue();
+$q->setIteratorMode(SplDoublyLinkedList::IT_MODE_FIFO);
+$q->setIteratorMode(SplDoublyLinkedList::IT_MODE_LIFO);
+
+try {
+ $q = new SplQueue();
+ $q->setIteratorMode(SplDoublyLinkedList::IT_MODE_FIFO);
+ $q->setIteratorMode(SplDoublyLinkedList::IT_MODE_LIFO);
+} catch (Exception $e) {
+ echo 'Exception: ' . $e->getMessage() . "\n";
+}
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Exception: Iterators' LIFO/FIFO modes for SplStack/SplQueue objects are frozen
|