xref: /PHP-7.3/ext/opcache/tests/opt/sccp_010.phpt (revision 9fe6b293)
1--TEST--
2SCCP 010: Conditional Constant Propagation of non-escaping object properties
3--INI--
4opcache.enable=1
5opcache.enable_cli=1
6opcache.optimization_level=-1
7opcache.opt_debug_level=0x20000
8--SKIPIF--
9<?php require_once('skipif.inc'); ?>
10--FILE--
11<?php
12function foo() {
13    $o = new stdClass();
14    $o->foo = 0;
15	$i = 1;
16	$c = $i < 2;
17	if ($c) {
18		$k = 2 * $i;
19		$o->foo = $i;
20		echo $o->foo;
21	}
22	echo $o->foo;
23}
24?>
25--EXPECTF--
26$_main: ; (lines=1, args=0, vars=0, tmps=0)
27    ; (after optimizer)
28    ; %ssccp_010.php:1-15
29L0 (15):    RETURN int(1)
30
31foo: ; (lines=3, args=0, vars=0, tmps=0)
32    ; (after optimizer)
33    ; %ssccp_010.php:2-13
34L0 (10):    ECHO int(1)
35L1 (12):    ECHO int(1)
36L2 (13):    RETURN null
37