Bug #75608 [Csd]: Narrowing occurred during type inference
| From: | nikic@php.net | Date: | Tue, 09 Jan 2018 17:48:27 +0000 |
| Subject: | Bug #75608 [Csd]: Narrowing occurred during type inference | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-213445@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=75608&edit=1
ID: 75608
Updated by: nikic@php.net
Reported by: anatoly dot pashin at gmail dot com
Summary: Narrowing occurred during type inference
Status: Closed
Type: Bug
Package: *General Issues
Operating System: centos
PHP Version: 7.1.12
Assigned To: laruence
Block user comment: N
Private report: N
New Comment:
@a dot hacicheant at gmail dot com: This additional issue how now been fixed with
https://github.com/php/php-src/commit/f208187773edd9423e64b5b4dd16b146260c780d.
Previous Comments:
------------------------------------------------------------------------
[2018-01-08 15:24:53] a dot hacicheant at gmail dot com
The problem is not solved in 7.1.3 version.
I've got the same issue with PHP_CodeSniffer
https://github.com/squizlabs/PHP_CodeSniffer/issues/1785
(last comments)
------------------------------------------------------------------------
[2017-12-04 14:40:14] anatoly dot pashin at gmail dot com
Sorry, Dmitry, is my code sampl ecovered too? Didn't found it in diff.
------------------------------------------------------------------------
[2017-12-04 14:23:43] dmitry@php.net
Automatic comment on behalf of dmitry@zend.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=5934bff91337b876195e9290b0811240052be7a3
Log: Fixed bug #75608 ("Narrowing occurred during type inference" error)
------------------------------------------------------------------------
[2017-12-04 02:58:48] anatoly dot pashin at gmail dot com
Laruence, I managed to get minimal reproducible example. Following code produces warning constantly.
class DeliveryTariffs extends BaseActiveRecord
{
public static function foo($arg1, $arg2 = null)
{
$a = self::someMethod();
$b = [];
foreach ($a as $c) {
foreach ($b as $d => $e) {
if (count(array_intersect($e['f'], $j['f'])) /
min(count($e['f']), count($j['f'])) > 0.5) {
$b[$d]['g'][$h] = $j['g'][$h];
$i = true;
break;
}
}
if (!$i) {
$b[] = $j;
}
}
return $b;
}
}
------------------------------------------------------------------------
[2017-12-04 02:01:12] anatoly dot pashin at gmail dot com
Laruence, I know problem is not in YiiBase.php :) it tries to include SpDelivery.php, which I
can't post here. If you agree to not share it, I can email it to you privately.
I can't determine which part of code in SpDelivery.php causes issue, because error goes away
from time to time when I try to edit that file. So I change any line, error gone. I change another
one and it's returned.
About file acm at tweakers dot net posted: I can't reproduce it from cli (because opcache is
disabled in cli). I see 'Narrowing occurred during type inference' error message when I
try to open it from webroot through php-fpm. But when I press f5 to refresh page, error is gone and
script is executed successfully.
PHP 7.1.12 (cli) (built: Dec 1 2017 14:08:55) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.1.12, Copyright (c) 1999-2017, by Zend Technologies
with Xdebug v2.5.5, Copyright (c) 2002-2017, by Derick Rethans
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=75608
--
Edit this bug report at https://bugs.php.net/bug.php?id=75608&edit=1