php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75630 Narrowing occurred during type inference
Submitted: 2017-12-05 10:00 UTC Modified: 2017-12-05 10:41 UTC
From: m dot sevastyanov at s7 dot ru Assigned:
Status: Duplicate Package: opcache
PHP Version: 7.1.12 OS: Linux/Windows
Private report: No CVE-ID: None
 [2017-12-05 10:00 UTC] m dot sevastyanov at s7 dot ru
Description:
------------
We get these strange errors when trying to require() or include() some classes.
I managed to extract some script part enough to reproduce it.

Test script:
---------------
php.ini:
opcache.enable_cli=1

narrowing.php:
<?php
class TestClass
{

	public function test()
	{
		$seqs = [];
		foreach ([] as $row) {
			foreach ($seqs as $i => $seq)
				$seqs[$i][] = 0;
			$seqs[] = 0;
		}
	}

}

php -c php.ini narrowing.php


Expected result:
----------------
no warning/error

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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-12-05 10:04 UTC] requinix@php.net
-Status: Open +Status: Feedback
 [2017-12-05 10:04 UTC] requinix@php.net
Please review the existing bugs to determine if any are relevant to you.
https://bugs.php.net/search.php?search_for=%22Narrowing+occurred+during+type+inference%22&boolean=2&cmd=display&status=All
 [2017-12-05 10:40 UTC] m dot sevastyanov at s7 dot ru
Looks like this one is related:
https://bugs.php.net/bug.php?id=75627
 [2017-12-05 10:41 UTC] requinix@php.net
-Status: Feedback +Status: Duplicate
 [2017-12-05 10:41 UTC] requinix@php.net
Please try using this snapshot:

  http://snaps.php.net/php-trunk-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/
 [2017-12-06 02:33 UTC] m dot sevastyanov at s7 dot ru
I confirm this bug is fixed in the snapshot for windows
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 12:01:30 2024 UTC