Bug #75687 [Com]: var 8 (TMP) has array key type but not value type
| From: | chris at ocproducts dot com | Date: | Thu, 14 Dec 2017 17:31:40 +0000 |
| Subject: | Bug #75687 [Com]: var 8 (TMP) has array key type but not value type | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-213102@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=75687&edit=1
ID: 75687
Comment by: chris at ocproducts dot com
Reported by: chris at ocproducts dot com
Summary: var 8 (TMP) has array key type but not value type
Status: Open
Type: Bug
Package: opcache
Operating System: Mac OS High Sierra (fully patche
PHP Version: 7.2.0
Block user comment: N
Private report: N
New Comment:
Here's a very different test case that reproduces the same issue...
function x()
{
$y = array();
foreach ($y as $z) {
var_dump(array($z));
}
}
Previous Comments:
------------------------------------------------------------------------
[2017-12-14 17:16:44] chris at ocproducts dot com
Description:
------------
The following test case produces noise when a lint is done, although the lint does ultimately pass.
Clearly the code is doing something unnecessary, but I don't believe opcache should be
complaining about it.
This affects PHP 5.2 and also current git HEAD.
Test script:
---------------
<?php
function x($y)
{
if (is_array($y)) {
$z = is_array($y) ? array() : array($y);
}
}
Expected result:
----------------
No syntax errors detected in (...)
Actual result:
--------------
In function ::x (after sccp):
var 8 (TMP) has array key type but not value type
var 9 (TMP) has array key type but not value type
var 10 (TMP) has array key type but not value type
var 11 (CV $z) has array key type but not value type
No syntax errors detected in (...)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=75687&edit=1