[php-src] Issue #8074: Value inside foreach is empty when doing maths with it (only with php-cgi and opcache activated)
Issue: https://github.com/php/php-src/issues/8074
Comment Author: cmb69
This is not really related to the SAPI, but rather an optimization issue:
````
> php -dopcache.opt_debug_level=0x50 ..\gh8074.php
$_main:
; (lines=3, args=0, vars=0, tmps=1)
; (after pass 5)
; C:\php-sdk\phpdev\vs16\x64\gh8074.php:1-10
; return [] RANGE[0..0]
0000 INIT_FCALL 0 192 string("test")
0001 DO_UCALL
0002 RETURN int(1)
test:
; (lines=14, args=0, vars=2, tmps=5)
; (after pass 5)
; C:\php-sdk\phpdev\vs16\x64\gh8074.php:2-8
; return [] RANGE[0..0]
0000 INIT_FCALL 2 112 string("range")
0001 SEND_VAL int(1) 1
0002 SEND_VAL string("2") 2
0003 V2 = DO_ICALL
0004 ASSIGN CV0($array) V2
0005 V4 = FE_RESET_R CV0($array) 0012
0006 FE_FETCH_R V4 CV1($i) 0012
0007 INIT_FCALL 1 96 string("var_dump")
0008 T5 = ADD CV1($i) int(1)
0009 SEND_VAL T5 1
0010 DO_ICALL
0011 JMP 0006
0012 FE_FREE V4
0013 RETURN null
$_main:
; (lines=3, args=0, vars=0, tmps=0, no_loops)
; (after pass 7)
; C:\php-sdk\phpdev\vs16\x64\gh8074.php:1-10
; return [long] RANGE[1..1]
0000 INIT_FCALL 0 192 string("test")
0001 DO_UCALL
0002 RETURN int(1)
test:
; (lines=14, args=0, vars=2, tmps=2)
; (after pass 7)
; C:\php-sdk\phpdev\vs16\x64\gh8074.php:2-8
; return [null] RANGE[0..0]
0000 INIT_FCALL 2 112 string("range")
0001 SEND_VAL int(1) 1
0002 SEND_VAL string("2") 2
0003 V2 = DO_ICALL
0004 CV0($array) = QM_ASSIGN V2
0005 V2 = FE_RESET_R CV0($array) 0012
0006 FE_FETCH_R V2 CV1($i) 0012
0007 INIT_FCALL 1 96 string("var_dump")
0008 T3 = ADD CV1($i) float(1)
0009 SEND_VAL T3 1
0010 DO_ICALL
0011 JMP 0006
0012 FE_FREE V2
0013 RETURN null
float(1)
float(1)
````
Thread (1 message)
- cmb69