We must not overwrite the SPL_DLLIST_IT_FIX flag when changing the
iterator mode.
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? 2017 PHP 7.0.25
-
+- SPL:
+ . Fixed bug #73629 (SplDoublyLinkedList::setIteratorMode masks intern flags).
+ (J. Jeising, cmb)
28 Sep 2017 PHP 7.0.24
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);
}
--- /dev/null
+--TEST--\r
+Bug #73629 (SplDoublyLinkedList::setIteratorMode masks intern flags)\r
+--FILE--\r
+<?php\r
+$q = new SplQueue();\r
+try {\r
+ $q->setIteratorMode(SplDoublyLinkedList::IT_MODE_FIFO);\r
+} catch (Exception $e) {\r
+ echo 'unexpected exception: ' . $e->getMessage() . "\n";\r
+}\r
+try {\r
+ $q->setIteratorMode(SplDoublyLinkedList::IT_MODE_LIFO);\r
+} catch (Exception $e) {\r
+ echo 'expected exception: ' . $e->getMessage() . "\n";\r
+}\r
+?>\r
+===DONE===\r
+--EXPECTF--\r
+expected exception: Iterators' LIFO/FIFO modes for SplStack/SplQueue objects are frozen\r
+===DONE===\r