Skip to content

Commit 1cc9933

Browse files
committed
Fixed bug #76463 (var has array key type but not value type)
1 parent 19d3143 commit 1cc9933

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ PHP NEWS
1212
- Interbase:
1313
. Fixed bug #76443 (php+php_interbase.dll crash on module_shutdown). (Kalle)
1414

15+
- Opcache:
16+
. Fixed bug #76463 (var has array key type but not value type). (Laruence)
17+
1518
- ZIP:
1619
. Fixed bug #76461 (OPSYS_Z_CPM defined instead of OPSYS_CPM).
1720
(Dennis Birkholz, Remi)

ext/opcache/Optimizer/zend_inference.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2406,7 +2406,7 @@ static int zend_update_type_info(const zend_op_array *op_array,
24062406
if (t1 & MAY_BE_OBJECT) {
24072407
tmp |= MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF;
24082408
} else {
2409-
tmp |= ((t1 & MAY_BE_ANY) << MAY_BE_ARRAY_SHIFT) | MAY_BE_ARRAY_KEY_LONG;
2409+
tmp |= ((t1 & MAY_BE_ANY) << MAY_BE_ARRAY_SHIFT) | ((t1 & MAY_BE_ANY)? MAY_BE_ARRAY_KEY_LONG : 0);
24102410
}
24112411
}
24122412
UPDATE_SSA_TYPE(tmp, ssa_ops[i].result_def);

ext/opcache/tests/bug76463.phpt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
--TEST--
2+
Bug #76463 (var 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 test() {
13+
$old_data = isset($old_data) ? (array)$old_data : [];
14+
}
15+
16+
?>
17+
okey
18+
--EXPECT--
19+
okey

0 commit comments

Comments
 (0)