1--TEST--
2Get by reference with hooked property
3--FILE--
4<?php
5
6class Test {
7    public $byVal { get { return []; } }
8}
9
10$test = new Test;
11
12try {
13    $test->byVal[] = 42;
14} catch (\Error $e) {
15    echo get_class($e) . ': ' . $e->getMessage() . "\n";
16}
17var_dump($test->byVal);
18
19try {
20    $test->byVal =& $ref;
21} catch (Error $e) {
22    echo get_class($e) . ': ' . $e->getMessage() . "\n";
23}
24
25?>
26--EXPECT--
27Error: Indirect modification of Test::$byVal is not allowed
28array(0) {
29}
30Error: Cannot assign by reference to overloaded object
31