File tree Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -3968,7 +3968,7 @@ static bool can_convert_to_double(
39683968 for (phi = var -> phi_use_chain ; phi ; phi = zend_ssa_next_use_phi (ssa , var_num , phi )) {
39693969 /* Check that narrowing can actually be useful */
39703970 type = ssa -> var_info [phi -> ssa_var ].type ;
3971- if (( type & MAY_BE_ANY ) & ~ (MAY_BE_LONG |MAY_BE_DOUBLE )) {
3971+ if (type & (( MAY_BE_ANY | MAY_BE_UNDEF ) - (MAY_BE_LONG |MAY_BE_DOUBLE ) )) {
39723972 return 0 ;
39733973 }
39743974
Original file line number Diff line number Diff line change 1+ --TEST--
2+ JIT ASSIGN: incorrect narrowing to double
3+ --INI--
4+ opcache.enable=1
5+ opcache.enable_cli=1
6+ opcache.file_update_protection=0
7+ opcache.jit_buffer_size=1M
8+ opcache.protect_memory=1
9+ --FILE--
10+ <?php
11+ function test (){
12+ $ x = (object )['x ' =>0 ];
13+ for ($ i =0 ;$ i <10 ;$ i ++){
14+ +$ a ;
15+ $ a =$ x ->x ;
16+ $ a =7 ;
17+ }
18+ }
19+ test ()
20+ ?>
21+ DONE
22+ --EXPECTF--
23+ Warning: Undefined variable $a in %sassign_047.php on line 5
24+ DONE
25+
You can’t perform that action at this time.
0 commit comments