xref: /php-src/ext/opcache/tests/opt/sccp_011.phpt (revision e48a5c14)
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
8opcache.preload=
9zend_test.observer.enabled=0
10--EXTENSIONS--
11opcache
12--FILE--
13<?php
14function foo(int $x) {
15    $o = new stdClass;
16    if ($x) {
17        $o->foo = 0;
18        $o->bar = 1;
19    } else {
20        $o->foo = 0;
21        $o->bar = 2;
22    }
23    echo $o->foo;
24}
25?>
26--EXPECTF--
27$_main:
28     ; (lines=1, args=0, vars=0, tmps=0)
29     ; (after optimizer)
30     ; %ssccp_011.php:1-14
310000 RETURN int(1)
32
33foo:
34     ; (lines=3, args=1, vars=1, tmps=0)
35     ; (after optimizer)
36     ; %ssccp_011.php:2-12
370000 CV0($x) = RECV 1
380001 ECHO string("0")
390002 RETURN null
40