1--TEST--
2Optimizer optimizes hooks, OpCache dump emits them
3--INI--
4opcache.enable=1
5opcache.enable_cli=1
6opcache.opt_debug_level=0x20000
7--EXTENSIONS--
8opcache
9--SKIPIF--
10<?php
11if (PHP_OS_FAMILY === 'Windows') {
12    die('skip Windows emits additional DECLARE_CLASS_DELAYED opcode');
13}
14?>
15--FILE--
16<?php
17
18class A {
19    public int $prop {
20        get {
21            return 42;
22            echo 'Dead code';
23        }
24        set {
25            echo "Setting $value";
26            return;
27            echo 'Dead code';
28        }
29    }
30}
31
32$a = new A();
33var_dump($a->prop);
34$a->prop = 41;
35
36?>
37--EXPECTF--
38$_main:
39     ; (lines=10, args=0, vars=1, tmps=%d)
40     ; (after optimizer)
41     ; %sdump_property_hooks.php:1-22
420000 V1 = NEW 0 string("A")
430001 DO_FCALL
440002 ASSIGN CV0($a) V1
450003 INIT_FCALL 1 %d string("var_dump")
460004 T1 = FETCH_OBJ_R CV0($a) string("prop")
470005 SEND_VAL T1 1
480006 DO_ICALL
490007 ASSIGN_OBJ CV0($a) string("prop")
500008 OP_DATA int(41)
510009 RETURN int(1)
52LIVE RANGES:
53     1: 0001 - 0002 (new)
54
55A::$prop::get:
56     ; (lines=1, args=0, vars=0, tmps=%d)
57     ; (after optimizer)
58     ; %sdump_property_hooks.php:5-8
590000 RETURN int(42)
60
61A::$prop::set:
62     ; (lines=4, args=1, vars=1, tmps=%d)
63     ; (after optimizer)
64     ; %sdump_property_hooks.php:9-13
650000 CV0($value) = RECV 1
660001 T1 = FAST_CONCAT string("Setting ") CV0($value)
670002 ECHO T1
680003 RETURN null
69int(42)
70Setting 41
71