[php-src] Issue #9204: The last item of list variable will be error when use reference of variable.

From: Date: Sat, 30 Jul 2022 13:15:24 +0000
Subject: [php-src] Issue #9204: The last item of list variable will be error when use reference of variable.
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-242083@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/9204 Author: cangzhu ### Description The following code: ```php <?php $list = [1,2,3,4]; foreach($list as &$it) { // DO NOTHING } // not unset $it foreach($list as $it) { echo "item = $it<br/>"; } ``` Resulted in this output: ``` item = 1 item = 2 item = 3 item = 3 ``` But I expected this output instead: ``` item = 1 item = 2 item = 3 item = 4 ``` ### PHP Version PHP7.4.30 ### Operating System Windows

« previous php.bugs (#242083) next »