Skip to content

Commit f70b552

Browse files
committed
Fixed bug #79193
1 parent be7eab3 commit f70b552

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ PHP NEWS
3939
. Fixed bug #79114 (Eval class during preload causes class to be only half
4040
available). (Laruence)
4141
. Fixed bug #79128 (Preloading segfaults if preload_user is used). (Nikita)
42+
. Fixed bug #79193 (Incorrect type inference for self::$field =& $field).
43+
(Nikita)
4244

4345
- OpenSSL:
4446
. Fixed bug #79145 (openssl memory leak). (cmb, Nikita)

ext/opcache/Optimizer/zend_inference.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2999,6 +2999,13 @@ static int zend_update_type_info(const zend_op_array *op_array,
29992999
UPDATE_SSA_TYPE(tmp, ssa_ops[i].op1_def);
30003000
}
30013001
break;
3002+
case ZEND_ASSIGN_STATIC_PROP_REF:
3003+
if ((opline+1)->op1_type == IS_CV) {
3004+
opline++;
3005+
i++;
3006+
UPDATE_SSA_TYPE(MAY_BE_REF, ssa_ops[i].op1_def);
3007+
}
3008+
break;
30023009
case ZEND_BIND_GLOBAL:
30033010
tmp = MAY_BE_REF | MAY_BE_ANY
30043011
| MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF;

ext/opcache/tests/bug79193.phpt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
--TEST--
2+
Bug #79193: Incorrect type inference for self::$field =& $field
3+
--FILE--
4+
<?php
5+
6+
class Test {
7+
public static $foo;
8+
public static function method($bar) {
9+
Test::$foo =& $bar;
10+
var_dump(is_int($bar));
11+
}
12+
}
13+
14+
Test::method(1);
15+
16+
?>
17+
--EXPECT--
18+
bool(true)

0 commit comments

Comments
 (0)