com php-src: Fixed bug #76463 (var has array key type but not value type): NEWS ext/opcache/Optimizer/zend_inference.c ext/opcache/t
ests/bug76463.phpt

From: Date: Tue, 12 Jun 2018 12:55:06 +0000
Subject: com php-src: Fixed bug #76463 (var has array key type but not value type): NEWS ext/opcache/Optimizer/zend_inference.c ext/opcache/t
ests/bug76463.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-102129@lists.php.net to get a copy of this message
Commit: 1cc9933130059993c09e43d95dc7a4dfc9621ab2 Author: Xinchen Hui <laruence@gmail.com> Tue, 12 Jun 2018 20:55:06 +0800 Parents: 19d31433dcb2fd3aa6148cb3f6cffe4b73b54523 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=1cc9933130059993c09e43d95dc7a4dfc9621ab2 Log: Fixed bug #76463 (var has array key type but not value type) Bugs: https://bugs.php.net/76463 Changed paths: M NEWS M ext/opcache/Optimizer/zend_inference.c A ext/opcache/tests/bug76463.phpt Diff: diff --git a/NEWS b/NEWS index f5f84fe..d702562 100644 --- a/NEWS +++ b/NEWS @@ -12,6 +12,9 @@ PHP NEWS - Interbase: . Fixed bug #76443 (php+php_interbase.dll crash on module_shutdown). (Kalle) +- Opcache: + . Fixed bug #76463 (var has array key type but not value type). (Laruence) + - ZIP: . Fixed bug #76461 (OPSYS_Z_CPM defined instead of OPSYS_CPM). (Dennis Birkholz, Remi) diff --git a/ext/opcache/Optimizer/zend_inference.c b/ext/opcache/Optimizer/zend_inference.c index 4414fb7..9298f98 100644 --- a/ext/opcache/Optimizer/zend_inference.c +++ b/ext/opcache/Optimizer/zend_inference.c @@ -2406,7 +2406,7 @@ static int zend_update_type_info(const zend_op_array *op_array, if (t1 & MAY_BE_OBJECT) { tmp |= MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF; } else { - tmp |= ((t1 & MAY_BE_ANY) << MAY_BE_ARRAY_SHIFT) | MAY_BE_ARRAY_KEY_LONG; + tmp |= ((t1 & MAY_BE_ANY) << MAY_BE_ARRAY_SHIFT) | ((t1 & MAY_BE_ANY)? MAY_BE_ARRAY_KEY_LONG : 0); } } UPDATE_SSA_TYPE(tmp, ssa_ops[i].result_def); diff --git a/ext/opcache/tests/bug76463.phpt b/ext/opcache/tests/bug76463.phpt new file mode 100644 index 0000000...0fa9be9 --- /dev/null +++ b/ext/opcache/tests/bug76463.phpt @@ -0,0 +1,19 @@ +--TEST-- +Bug #76463 (var 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 test() { + $old_data = isset($old_data) ? (array)$old_data : []; +} + +?> +okey +--EXPECT-- +okey

« previous php.cvs (#102129) next »