Bug #79109 [NEW]: foreach on empty array
| From: | a dot dankovtsev at mail dot ru | Date: | Mon, 13 Jan 2020 13:25:14 +0000 |
| Subject: | Bug #79109 [NEW]: foreach on empty array | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-224878@lists.php.net to get a copy of this message | ||
From: a dot dankovtsev at mail dot ru
Operating system: debian stretch
PHP version: 7.4.1
Package: opcache
Bug Type: Bug
Bug description:foreach on empty array
Description:
------------
In test env in our product sometimes caused Undefined variable $value
with empty array
But local don't reproduce
Test script:
---------------
<?php
class Test
{
private const PRIVATE_ARRAY = [];
public function run(): int
{
foreach (self::PRIVATE_ARRAY as $key => $value) {
return $value;
}
return 1;
}
}
(new Test())->run();
--
Edit bug report at https://bugs.php.net/bug.php?id=79109&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=79109&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=79109&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=79109&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=79109&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=79109&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=79109&r=support
Expected behavior: https://bugs.php.net/fix.php?id=79109&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=79109&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=79109&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=79109&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=79109&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=79109&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=79109&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=79109&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=79109&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=79109&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=79109&r=mysqlcfg