xref: /PHP-8.1/Zend/tests/dereference_007.phpt (revision 36935e42)
1--TEST--
2Trying to write on method return
3--FILE--
4<?php
5
6error_reporting(E_ALL);
7
8class foo {
9    public $x = array();
10
11    public function b() {
12        return $this->x;
13    }
14
15    public function c() {
16        return $x;
17    }
18
19    static public function d() {
20
21    }
22}
23
24$foo = new foo;
25
26$foo->b()[0] = 1;
27
28$foo->c()[100] = 2;
29
30foo::d()[] = 3;
31
32print "ok\n";
33
34?>
35--EXPECTF--
36Warning: Undefined variable $x in %s on line %d
37ok
38