xref: /PHP-8.4/ext/opcache/tests/opt/dce_006.phpt (revision e48a5c14)
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=
9zend_test.observer.enabled=0
10--EXTENSIONS--
11opcache
12--FILE--
13<?php
14class A {
15    function __destruct() {}
16}
17function foo(int $x) {
18    $a = new A;
19    $a->foo = $x;
20}
21?>
22--EXPECTF--
23$_main:
24     ; (lines=1, args=0, vars=0, tmps=0)
25     ; (after optimizer)
26     ; %sdce_006.php:1-10
270000 RETURN int(1)
28
29foo:
30     ; (lines=7, args=1, vars=2, tmps=1)
31     ; (after optimizer)
32     ; %sdce_006.php:5-8
330000 CV0($x) = RECV 1
340001 V2 = NEW 0 string("A")
350002 DO_FCALL
360003 CV1($a) = QM_ASSIGN V2
370004 ASSIGN_OBJ CV1($a) string("foo")
380005 OP_DATA CV0($x)
390006 RETURN null
40LIVE RANGES:
41     2: 0002 - 0003 (new)
42
43A::__destruct:
44     ; (lines=1, args=0, vars=0, tmps=0)
45     ; (after optimizer)
46     ; %sdce_006.php:3-3
470000 RETURN null
48