Bug #77014 [Com]: Array traversal issues PHP 7+
| From: | george dot banyard at gmail dot com | Date: | Mon, 26 Nov 2018 14:34:30 +0000 |
| Subject: | Bug #77014 [Com]: Array traversal issues PHP 7+ | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-218135@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=77014&edit=1
ID: 77014
Comment by: george dot banyard at gmail dot com
Reported by: mishamosher at gmail dot com
Summary: Array traversal issues PHP 7+
Status: Open
Type: Bug
Package: Arrays related
PHP Version: 7.2.11
Block user comment: N
Private report: N
New Comment:
I don't think this is a bug with the array traversal but more with the copying of the array
state when the function is executed.
If you reverse the order of execution as shown here: https://3v4l.org/l1bYA
You get the same result in PHP5.x and 7.x
Only difference that I know of is that before PHP7 foreach would use the internal pointer of the
array which isn't necessary any more.
So maybe there was a pointer reset mechanism for all loops which has been removed during the
transition from 5 to 7.
Also I do think the new behaviour in this case is Intended and wouldn't considered it a bug.
Previous Comments:
------------------------------------------------------------------------
[2018-10-15 15:09:30] mishamosher at gmail dot com
Description:
------------
There is a different behaviour between PHP 5.x and 7.x when traversing arrays.
I can not find if this is intended, so I'm supposing its a bug.
Test script:
---------------
https://3v4l.org/YNJ18
Expected result:
----------------
I expect the same output on PHP 5.x and 7.x.
Actual result:
--------------
The outputs differ between PHP 5.x and 7.x.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=77014&edit=1