xref: /PHP-8.0/ext/opcache/tests/opt/sccp_010.phpt (revision 0684b9fc)
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
8opcache.preload=
9--SKIPIF--
10<?php require_once('skipif.inc'); ?>
11--FILE--
12<?php
13function foo() {
14    $o = new stdClass();
15    $o->foo = 0;
16    $i = 1;
17    $c = $i < 2;
18    if ($c) {
19        $k = 2 * $i;
20        $o->foo = $i;
21        echo $o->foo;
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_010.php:1-15
310000 RETURN int(1)
32
33foo:
34     ; (lines=3, args=0, vars=0, tmps=0)
35     ; (after optimizer)
36     ; %ssccp_010.php:2-13
370000 ECHO string("1")
380001 ECHO string("1")
390002 RETURN null
40