xref: /PHP-7.4/ext/opcache/tests/opt/dce_006.phpt (revision 88a2268d)
1--TEST--
2DCE 006: Objects with destructors escape
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
13class A {
14	function __destruct() {}
15}
16function foo(int $x) {
17	$a = new A;
18	$a->foo = $x;
19}
20--EXPECTF--
21$_main: ; (lines=1, args=0, vars=0, tmps=0)
22    ; (after optimizer)
23    ; %sdce_006.php:1-9
24L0 (9):     RETURN int(1)
25
26foo: ; (lines=7, args=1, vars=2, tmps=1)
27    ; (after optimizer)
28    ; %sdce_006.php:5-8
29L0 (5):     CV0($x) = RECV 1
30L1 (6):     V2 = NEW 0 string("A")
31L2 (6):     DO_FCALL
32L3 (6):     CV1($a) = QM_ASSIGN V2
33L4 (7):     ASSIGN_OBJ CV1($a) string("foo")
34L5 (7):     OP_DATA CV0($x)
35L6 (8):     RETURN null
36LIVE RANGES:
37        2: L2 - L3 (new)
38
39A::__destruct: ; (lines=1, args=0, vars=0, tmps=0)
40    ; (after optimizer)
41    ; %sdce_006.php:3-3
42L0 (3):     RETURN null
43