xref: /PHP-8.0/ext/opcache/tests/opt/dce_006.phpt (revision 7aacc705)
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?>
21--EXPECTF--
22$_main:
23     ; (lines=1, args=0, vars=0, tmps=0)
24     ; (after optimizer)
25     ; %sdce_006.php:1-10
260000 RETURN int(1)
27
28foo:
29     ; (lines=7, args=1, vars=2, tmps=1)
30     ; (after optimizer)
31     ; %sdce_006.php:5-8
320000 CV0($x) = RECV 1
330001 V2 = NEW 0 string("A")
340002 DO_FCALL
350003 CV1($a) = QM_ASSIGN V2
360004 ASSIGN_OBJ CV1($a) string("foo")
370005 OP_DATA CV0($x)
380006 RETURN null
39LIVE RANGES:
40     2: 0002 - 0003 (new)
41
42A::__destruct:
43     ; (lines=1, args=0, vars=0, tmps=0)
44     ; (after optimizer)
45     ; %sdce_006.php:3-3
460000 RETURN null
47