php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75687 var 8 (TMP) has array key type but not value type
Submitted: 2017-12-14 17:16 UTC Modified: -
From: chris at ocproducts dot com Assigned:
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 17:16 UTC] 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 (...)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-12-14 17:31 UTC] chris at ocproducts dot com
Here's a very different test case that reproduces the same issue...

function x()
{
    $y = array();
    foreach ($y as $z) {
        var_dump(array($z));
    }
}
 [2017-12-16 15:59 UTC] laruence@php.net
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=a20c9bd3fec9b1df83193ae0db18cb04064461e3
Log: Fixed bug #75687 (var 8 (TMP) has array key type but not value type)
 [2017-12-16 16:00 UTC] laruence@php.net
-Status: Open +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Dec 03 17:01:29 2024 UTC