Bug #79109 [Opn->Dup]: foreach on empty array
| From: | nikic@php.net | Date: | Mon, 13 Jan 2020 13:28:07 +0000 |
| Subject: | Bug #79109 [Opn->Dup]: foreach on empty array | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-224879@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=79109&edit=1
ID: 79109
Updated by: nikic@php.net
Reported by: a dot dankovtsev at mail dot ru
Summary: foreach on empty array
-Status: Open
+Status: Duplicate
Type: Bug
Package: opcache
Operating System: debian stretch
PHP Version: 7.4.1
Block user comment: N
Private report: N
New Comment:
I don't think we have a bug reference for it, but this issue is already fixed in 7.4.2.
It is related to opcache, which is likely why you can't reproduce locally.
Previous Comments:
------------------------------------------------------------------------
[2020-01-13 13:25:14] a dot dankovtsev at mail dot ru
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 this bug report at https://bugs.php.net/bug.php?id=79109&edit=1