xref: /PHP-7.3/ext/opcache/tests/opt/sccp_011.phpt (revision 9fe6b293)
1--TEST--
2SCCP 011: 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(int $x) {
13	$o = new stdClass;
14	if ($x) {
15		$o->foo = 0;
16		$o->bar = 1;
17	} else {
18		$o->foo = 0;
19		$o->bar = 2;
20	}
21	echo $o->foo;
22}
23?>
24--EXPECTF--
25$_main: ; (lines=1, args=0, vars=0, tmps=0)
26    ; (after optimizer)
27    ; %ssccp_011.php:1-14
28L0 (14):    RETURN int(1)
29
30foo: ; (lines=3, args=1, vars=1, tmps=0)
31    ; (after optimizer)
32    ; %ssccp_011.php:2-12
33L0 (2):     CV0($x) = RECV 1
34L1 (11):    ECHO int(0)
35L2 (12):    RETURN null
36