Skip to content

Commit

Permalink
Fixed bug #75687 (var 8 (TMP) has array key type but not value type)
Browse files Browse the repository at this point in the history
  • Loading branch information
laruence committed Dec 16, 2017
1 parent eb77c2c commit a20c9bd
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
4 changes: 4 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ PHP NEWS
- Core:
. Fixed bug #75679 (Path 260 character problem). (Anatol)

- Opcache:
. Fixed bug #75687 (var 8 (TMP) has array key type but not value type).
(Laruence)

- PGSQL:
. Fixed bug #75671 (pg_version() crashes when called on a connection to
cockroach). (magicaltux at gmail dot com)
Expand Down
3 changes: 3 additions & 0 deletions ext/opcache/Optimizer/zend_inference.c
Original file line number Diff line number Diff line change
Expand Up @@ -3338,6 +3338,9 @@ int zend_infer_types_ex(const zend_op_array *op_array, const zend_script *script
/* Ignore the constraint (either ce instanceof constraint->ce or
* they are unrelated, as far as we can statically determine) */
}
} else if ((tmp & MAY_BE_ANY) == 0) {
/* FIXME: usage in unreachable block */
tmp |= MAY_BE_UNDEF;
}
}

Expand Down
21 changes: 21 additions & 0 deletions ext/opcache/tests/bug75687.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
--TEST--
Bug #75687 (var 8 (TMP) has array key type but not value type)
--INI--
opcache.enable=1
opcache.enable_cli=1
opcache.optimization_level=-1
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php

function x($y)
{
if (is_array($y)) {
$z = is_array($y) ? array() : array($y);
}
}
?>
okey
--EXPECT--
okey

0 comments on commit a20c9bd

Please sign in to comment.