xref: /PHP-7.3/ext/opcache/tests/opt/dce_006.phpt (revision 9fe6b293)
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
8--SKIPIF--
9<?php require_once('skipif.inc'); ?>
10--FILE--
11<?php
12class A {
13	function __destruct() {}
14}
15function foo(int $x) {
16	$a = new A;
17	$a->foo = $x;
18}
19--EXPECTF--
20$_main: ; (lines=1, args=0, vars=0, tmps=0)
21    ; (after optimizer)
22    ; %sdce_006.php:1-9
23L0 (9):     RETURN int(1)
24
25foo: ; (lines=7, args=1, vars=2, tmps=1)
26    ; (after optimizer)
27    ; %sdce_006.php:5-8
28L0 (5):     CV0($x) = RECV 1
29L1 (6):     V2 = NEW 0 string("A")
30L2 (6):     DO_FCALL
31L3 (6):     CV1($a) = QM_ASSIGN V2
32L4 (7):     ASSIGN_OBJ CV1($a) string("foo")
33L5 (7):     OP_DATA CV0($x)
34L6 (8):     RETURN null
35
36A::__destruct: ; (lines=1, args=0, vars=0, tmps=0)
37    ; (after optimizer)
38    ; %sdce_006.php:3-3
39L0 (3):     RETURN null
40