File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -2614,6 +2614,10 @@ static zend_always_inline int _zend_update_type_info(
2614
2614
* results in a null return value. */
2615
2615
tmp |= MAY_BE_NULL ;
2616
2616
}
2617
+ if (tmp & MAY_BE_REF ) {
2618
+ /* Typed reference may cause auto conversion */
2619
+ tmp |= MAY_BE_ANY ;
2620
+ }
2617
2621
} else if (opline -> opcode == ZEND_ASSIGN_OBJ_OP ) {
2618
2622
/* The return value must also satisfy the property type */
2619
2623
if (prop_info ) {
@@ -2624,6 +2628,11 @@ static zend_always_inline int _zend_update_type_info(
2624
2628
if (prop_info ) {
2625
2629
tmp &= zend_fetch_prop_type (script , prop_info , NULL );
2626
2630
}
2631
+ } else {
2632
+ if (tmp & MAY_BE_REF ) {
2633
+ /* Typed reference may cause auto conversion */
2634
+ tmp |= MAY_BE_ANY ;
2635
+ }
2627
2636
}
2628
2637
tmp &= ~MAY_BE_REF ;
2629
2638
UPDATE_SSA_TYPE (tmp , ssa_op -> result_def );
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ JIT ASSIGN_OP: 002
3
+ --INI--
4
+ opcache.enable=1
5
+ opcache.enable_cli=1
6
+ opcache.file_update_protection=0
7
+ opcache.jit_buffer_size=1M
8
+ --FILE--
9
+ <?php
10
+ class Test {
11
+ public ?string $ prop = "0 " ;
12
+ }
13
+ function test () {
14
+ $ obj = new Test ;
15
+ $ ref =& $ obj ->prop ;
16
+ var_dump ($ ref &= 1 );
17
+ }
18
+ test ();
19
+ ?>
20
+ --EXPECT--
21
+ string(1) "0"
You can’t perform that action at this time.
0 commit comments