php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75681 Warning: Narrowing occurred during type inference (specific case)
Submitted: 2017-12-14 02:54 UTC Modified: 2017-12-16 20:26 UTC
From: chris at ocproducts dot com Assigned: nikic (profile)
Status: Closed Package: opcache
PHP Version: 7.2.0 OS: Mac OS High Sierra (fully patche
Private report: No CVE-ID: None
 [2017-12-14 02:54 UTC] chris at ocproducts dot com
Description:
------------
Running on the latest of everything, the attached reduced test case fails when opcache is enabled.

"Warning: Narrowing occurred during type inference. Please file a bug report on bugs.php.net in Unknown on line 0"

It is affecting Composr CMS, we found it from in the wild for customer(s) upgraded to PHP 7.2.

This is not fixed by these commits:
https://github.com/php/php-src/commit/776bef8447f2848c043e4716a1e08c4ac5a88fdb
https://github.com/php/php-src/commit/5934bff91337b876195e9290b0811240052be7a3
I also confirmed it is not fixed in git HEAD.

Test script:
---------------
<?php

function foobar()
{
    do {
        foreach ($a as $i => $_) {
            $a[$i][0] += 1;
        }

        $a[] = array(0, 0);
    } while ($x !== false);
}



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-12-14 03:00 UTC] chris at ocproducts dot com
Weirdly the fixes do seem to have corrected the issue in the original context in my code.
Only my test case now fails.
 [2017-12-16 20:26 UTC] nikic@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: nikic
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 08:01:30 2024 UTC