Bug #74980 [Com]: Narrowing occurred during type inference
| From: | cschneid@php.net | Date: | Mon, 24 Jul 2017 15:31:54 +0000 |
| Subject: | Bug #74980 [Com]: Narrowing occurred during type inference | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-210283@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=74980&edit=1
ID: 74980
Comment by: cschneid@php.net
Reported by: cschneid@php.net
Summary: Narrowing occurred during type inference
Status: Open
Type: Bug
Package: opcache
Operating System: openSUSE 42.2 (x86_64)
PHP Version: 7.2.0beta1
Block user comment: N
Private report: N
New Comment:
I managed to produce a test file narrowing.php
<?php
class A
{
static function foo()
{
foreach ([] as $value)
$arr["foo"]["bar"] = $value;
foreach ($arr as $value)
bar($value + []);
}
}
with a php.ini like
zend_extension = opcache.so
opcache.enable_cli = 1
and then calling it with
php -c php.ini narrowing.php
results in
Warning: Narrowing occurred during type inference. Please file a bug report on bugs.php.net in
Unknown on line 0
Previous Comments:
------------------------------------------------------------------------
[2017-07-24 13:30:46] nikic@php.net
Are you able to determine on which file this is triggered (e.g. by just printing out the file name
in the class loader and seeing after which the error occurs)? I'm assuming it's probably
not the class loader itself?
If you can find the file, can you send it to nikic@php.net? This is one of those cases where a
single file should be able to reliably reproduce the problem without context.
------------------------------------------------------------------------
[2017-07-24 12:46:36] cschneid@php.net
Description:
------------
Our codebase triggered
"E_WARNING: Narrowing occurred during type inference. Please file a bug report on
bugs.php.net"
in our class loader which is installed using spl_autoload_register().
When trying to fetch the page a second time it reports
"Fatal error: Cannot declare class xy, because the name is already in use in xy.class on
line 3"
Doing
sudo apachectl graceful
to clear the opcache and reloading bring the Narrowing warning again.
I don't have a short reproduction script but I still reported the bug as the warning says so
:-)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=74980&edit=1