Bug #76377 [NEW]: foreach( $a as $a ) works fine ...
| From: | nicolas dot aubanel at gmail dot com | Date: | Fri, 25 May 2018 13:50:33 +0000 |
| Subject: | Bug #76377 [NEW]: foreach( $a as $a ) works fine ... | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-215369@lists.php.net to get a copy of this message | ||
From: nicolas dot aubanel at gmail dot com
Operating system: macos
PHP version: 7.0.30
Package: *General Issues
Bug Type: Bug
Bug description:foreach( $a as $a ) works fine ...
Description:
------------
---
From manual page: http://www.php.net/control-structures.foreach
---
array expression is not reevaluated on each loop
Test script:
---------------
$a = array(1 => array("test1"), 2, 3, 17);
foreach ($a as $a) {
var_dump( $a );
}
Expected result:
----------------
array(1) {
[0]=>
string(4) "test1"
}
string(4) "test1"
Actual result:
--------------
array(1) {
[0]=>
string(4) "test1"
}
int(2)
int(3)
int(17)
--
Edit bug report at https://bugs.php.net/bug.php?id=76377&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=76377&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=76377&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=76377&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=76377&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=76377&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=76377&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=76377&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=76377&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=76377&r=support
Expected behavior: https://bugs.php.net/fix.php?id=76377&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=76377&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=76377&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=76377&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=76377&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=76377&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=76377&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=76377&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=76377&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=76377&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=76377&r=mysqlcfg