xref: /PHP-8.4/ext/opcache/tests/opt/sccp_010.phpt (revision e48a5c14)
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=
9zend_test.observer.enabled=0
10--EXTENSIONS--
11opcache
12--FILE--
13<?php
14function foo() {
15    $o = new stdClass();
16    $o->foo = 0;
17    $i = 1;
18    $c = $i < 2;
19    if ($c) {
20        $k = 2 * $i;
21        $o->foo = $i;
22        echo $o->foo;
23    }
24    echo $o->foo;
25}
26?>
27--EXPECTF--
28$_main:
29     ; (lines=1, args=0, vars=0, tmps=0)
30     ; (after optimizer)
31     ; %ssccp_010.php:1-15
320000 RETURN int(1)
33
34foo:
35     ; (lines=3, args=0, vars=0, tmps=0)
36     ; (after optimizer)
37     ; %ssccp_010.php:2-13
380000 ECHO string("1")
390001 ECHO string("1")
400002 RETURN null
41