summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-01-30 14:55:58 +0100
committerNikita Popov <nikita.ppv@gmail.com>2020-01-30 14:55:58 +0100
commitf70b552326e5242655d6ac2c55ca220e89afef34 (patch)
treeecef18047bc45c848f922524608859b76477d662
parentbe7eab3202567a1acf0158d281362c20d5051767 (diff)
downloadphp-git-f70b552326e5242655d6ac2c55ca220e89afef34.tar.gz
Fixed bug #79193
-rw-r--r--NEWS2
-rw-r--r--ext/opcache/Optimizer/zend_inference.c7
-rw-r--r--ext/opcache/tests/bug79193.phpt18
3 files changed, 27 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index 2dcfdf9db3..a4ef1ef469 100644
--- a/NEWS
+++ b/NEWS
@@ -39,6 +39,8 @@ PHP NEWS
. Fixed bug #79114 (Eval class during preload causes class to be only half
available). (Laruence)
. Fixed bug #79128 (Preloading segfaults if preload_user is used). (Nikita)
+ . Fixed bug #79193 (Incorrect type inference for self::$field =& $field).
+ (Nikita)
- OpenSSL:
. Fixed bug #79145 (openssl memory leak). (cmb, Nikita)
diff --git a/ext/opcache/Optimizer/zend_inference.c b/ext/opcache/Optimizer/zend_inference.c
index f89b133b92..7accf73a5d 100644
--- a/ext/opcache/Optimizer/zend_inference.c
+++ b/ext/opcache/Optimizer/zend_inference.c
@@ -2999,6 +2999,13 @@ static int zend_update_type_info(const zend_op_array *op_array,
UPDATE_SSA_TYPE(tmp, ssa_ops[i].op1_def);
}
break;
+ case ZEND_ASSIGN_STATIC_PROP_REF:
+ if ((opline+1)->op1_type == IS_CV) {
+ opline++;
+ i++;
+ UPDATE_SSA_TYPE(MAY_BE_REF, ssa_ops[i].op1_def);
+ }
+ break;
case ZEND_BIND_GLOBAL:
tmp = MAY_BE_REF | MAY_BE_ANY
| MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF;
diff --git a/ext/opcache/tests/bug79193.phpt b/ext/opcache/tests/bug79193.phpt
new file mode 100644
index 0000000000..c500400363
--- /dev/null
+++ b/ext/opcache/tests/bug79193.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Bug #79193: Incorrect type inference for self::$field =& $field
+--FILE--
+<?php
+
+class Test {
+ public static $foo;
+ public static function method($bar) {
+ Test::$foo =& $bar;
+ var_dump(is_int($bar));
+ }
+}
+
+Test::method(1);
+
+?>
+--EXPECT--
+bool(true)