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--FILE--
10<?php
11
12class A {
13    public int $prop {
14        get {
15            return 42;
16            echo 'Dead code';
17        }
18        set {
19            echo "Setting $value";
20            return;
21            echo 'Dead code';
22        }
23    }
24}
25
26$a = new A();
27var_dump($a->prop);
28$a->prop = 41;
29
30?>
31--EXPECTF--
32$_main:
33     ; (lines=10, args=0, vars=1, tmps=%d)
34     ; (after optimizer)
35     ; %sdump_property_hooks.php:1-22
360000 V1 = NEW 0 string("A")
370001 DO_FCALL
380002 ASSIGN CV0($a) V1
390003 INIT_FCALL 1 %d string("var_dump")
400004 T1 = FETCH_OBJ_R CV0($a) string("prop")
410005 SEND_VAL T1 1
420006 DO_ICALL
430007 ASSIGN_OBJ CV0($a) string("prop")
440008 OP_DATA int(41)
450009 RETURN int(1)
46LIVE RANGES:
47     1: 0001 - 0002 (new)
48
49A::$prop::get:
50     ; (lines=1, args=0, vars=0, tmps=%d)
51     ; (after optimizer)
52     ; %sdump_property_hooks.php:5-8
530000 RETURN int(42)
54
55A::$prop::set:
56     ; (lines=4, args=1, vars=1, tmps=%d)
57     ; (after optimizer)
58     ; %sdump_property_hooks.php:9-13
590000 CV0($value) = RECV 1
600001 T1 = FAST_CONCAT string("Setting ") CV0($value)
610002 ECHO T1
620003 RETURN null
63int(42)
64Setting 41
65