Bug #77640 [Opn->Nab]: Array Destructuring Reference Assignments
| From: | requinix@php.net | Date: | Tue, 19 Feb 2019 18:58:07 +0000 |
| Subject: | Bug #77640 [Opn->Nab]: Array Destructuring Reference Assignments | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-219640@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=77640&edit=1
ID: 77640
Updated by: requinix@php.net
Reported by: qRoc dot Work at gmail dot com
Summary: Array Destructuring Reference Assignments
-Status: Open
+Status: Not a bug
Type: Bug
Package: *General Issues
Operating System: OS X/Linux
PHP Version: 7.3.2
Block user comment: N
Private report: N
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
http://php.net/manual/en/control-structures.foreach.php
Big red warning
Previous Comments:
------------------------------------------------------------------------
[2019-02-19 13:18:28] qRoc dot Work at gmail dot com
Description:
------------
Not correct result for last element if use "Array Destructuring Reference Assignments"
Test script:
---------------
<?php
$timeUnits = [[2], [4], [8]];
foreach ($timeUnits as [&$baseCount]) {
$baseCount += 1;
}
foreach ($timeUnits as [&$baseCount]) { echo $baseCount; } echo PHP_EOL;
foreach ($timeUnits as [$baseCount]) { echo $baseCount; } echo PHP_EOL;
foreach ($timeUnits as [&$baseCount]) { echo $baseCount; } echo PHP_EOL;
Expected result:
----------------
359
359
359
Actual result:
--------------
359
355
355
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=77640&edit=1