com php-src: Fixed bug #73629 (SplDoublyLinkedList::setIteratorMode masks intern flags): NEWS ext/spl/spl_dllist.c ext/spl/tests/bu g73629.phpt

From: Date: Wed, 20 Sep 2017 13:46:04 +0000
Subject: com php-src: Fixed bug #73629 (SplDoublyLinkedList::setIteratorMode masks intern flags): NEWS ext/spl/spl_dllist.c ext/spl/tests/bu g73629.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-99470@lists.php.net to get a copy of this message
Commit: eedc060c92e12e054a542dc7156e31cec935a8d6 Author: Christoph M. Becker <cmbecker69@gmx.de> Wed, 20 Sep 2017 15:36:50 +0200 Parents: 9641586efa861abc1f6b1dba9efba73a065e3ca5 Branches: PHP-7.0 PHP-7..1 PHP-7.2 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=eedc060c92e12e054a542dc7156e31cec935a8d6 Log: Fixed bug #73629 (SplDoublyLinkedList::setIteratorMode masks intern flags) We must not overwrite the SPL_DLLIST_IT_FIX flag when changing the iterator mode. Bugs: https://bugs.php.net/73629 Changed paths: M NEWS M ext/spl/spl_dllist.c A ext/spl/tests/bug73629.phpt Diff: diff --git a/NEWS b/NEWS index 8793399..acc2648 100644 --- a/NEWS +++ b/NEWS @@ -2,7 +2,9 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 2017 PHP 7.0.25 - +- SPL: + . Fixed bug #73629 (SplDoublyLinkedList::setIteratorMode masks intern flags). + (J. Jeising, cmb) 28 Sep 2017 PHP 7.0..24 diff --git a/ext/spl/spl_dllist.c b/ext/spl/spl_dllist.c index c205de5..db9fa83 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 0000000..5b6587c --- /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===

« previous php.cvs (#99470) next »