1--TEST-- 2SCCP 004: Conditional Constant Propagation of non-escaping array elements 3--INI-- 4opcache.enable=1 5opcache.enable_cli=1 6opcache.optimization_level=-1 7opcache.opt_debug_level=0x20000 8opcache.preload= 9--EXTENSIONS-- 10opcache 11--FILE-- 12<?php 13function foo(int $x) { 14 $a = [1,2,3]; 15 $a[2] = $x; 16 $i = 1; 17 $c = $i < 2; 18 if ($c) { 19 $k = 2 * $i; 20 $a[$k] = $i; 21// $a[$k]++; 22 echo isset($a[$k]); 23// $a[$k] += 5; 24 } 25 echo $a[2]; 26} 27?> 28--EXPECTF-- 29$_main: 30 ; (lines=1, args=0, vars=0, tmps=0) 31 ; (after optimizer) 32 ; %ssccp_004.php:1-17 330000 RETURN int(1) 34 35foo: 36 ; (lines=4, args=1, vars=1, tmps=0) 37 ; (after optimizer) 38 ; %ssccp_004.php:2-15 390000 CV0($x) = RECV 1 400001 ECHO string("1") 410002 ECHO string("1") 420003 RETURN null 43