Skip to content

Commit a20c9bd

Browse files
committed
Fixed bug #75687 (var 8 (TMP) has array key type but not value type)
1 parent eb77c2c commit a20c9bd

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ PHP NEWS
55
- Core:
66
. Fixed bug #75679 (Path 260 character problem). (Anatol)
77

8+
- Opcache:
9+
. Fixed bug #75687 (var 8 (TMP) has array key type but not value type).
10+
(Laruence)
11+
812
- PGSQL:
913
. Fixed bug #75671 (pg_version() crashes when called on a connection to
1014
cockroach). (magicaltux at gmail dot com)

ext/opcache/Optimizer/zend_inference.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3338,6 +3338,9 @@ int zend_infer_types_ex(const zend_op_array *op_array, const zend_script *script
33383338
/* Ignore the constraint (either ce instanceof constraint->ce or
33393339
* they are unrelated, as far as we can statically determine) */
33403340
}
3341+
} else if ((tmp & MAY_BE_ANY) == 0) {
3342+
/* FIXME: usage in unreachable block */
3343+
tmp |= MAY_BE_UNDEF;
33413344
}
33423345
}
33433346

ext/opcache/tests/bug75687.phpt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
--TEST--
2+
Bug #75687 (var 8 (TMP) has array key type but not value type)
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
opcache.optimization_level=-1
7+
--SKIPIF--
8+
<?php require_once('skipif.inc'); ?>
9+
--FILE--
10+
<?php
11+
12+
function x($y)
13+
{
14+
if (is_array($y)) {
15+
$z = is_array($y) ? array() : array($y);
16+
}
17+
}
18+
?>
19+
okey
20+
--EXPECT--
21+
okey

0 commit comments

Comments
 (0)