Bug #72292 [Opn->Nab]: Invalid foreach $value pointer if $value was iterated by reference previously

From: Date: Mon, 30 May 2016 20:44:13 +0000
Subject: Bug #72292 [Opn->Nab]: Invalid foreach $value pointer if $value was iterated by reference previously
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-201352@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=72292&edit=1 ID: 72292 Updated by: requinix@php.net Reported by: cronfy at gmail dot com Summary: Invalid foreach $value pointer if $value was iterated by reference previously -Status: Open +Status: Not a bug Type: Bug Package: Arrays related Operating System: Linux Mint 17.1 Rebecca PHP Version: 5.6.22 Block user comment: N Private report: N New Comment: See bug #71458 Previous Comments: ------------------------------------------------------------------------ [2016-05-30 16:52:03] cronfy at gmail dot com Description: ------------ PHP version 5.6.22 from PHP 5.6.22-2+donate.sury.org~trusty+1 When array is firstly iterated by reference for $value, and then iterated without reference, last $value in second foreach is incorrect. Test script: --------------- $arr = [1, 2]; foreach ($arr as &$value) {} foreach ($arr as $value) { echo "$value\n"; } Expected result: ---------------- 1 2 Actual result: -------------- 1 1 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=72292&edit=1

« previous php.bugs (#201352) next »