xref: /PHP-8.1/Zend/tests/026.phpt (revision d30cd7d7)
1--TEST--
2Trying assign value to property when an object is not returned in a function
3--FILE--
4<?php
5
6class foo {
7    public function a() {
8    }
9}
10
11$test = new foo;
12
13$test->a()->a;
14print "ok\n";
15
16try {
17    $test->a()->a = 1;
18} catch (Error $e) {
19    echo $e->getMessage(), "\n";
20}
21print "ok\n";
22
23?>
24--EXPECTF--
25Warning: Attempt to read property "a" on null in %s on line %d
26ok
27Attempt to assign property "a" on null
28ok
29