xref: /PHP-7.4/Zend/tests/dereference_010.phpt (revision c42b7dd6)
1--TEST--
2Testing dereference in non-array values
3--FILE--
4<?php
5
6error_reporting(E_ALL);
7
8function a() {
9	return 1;
10}
11
12$a = 1;
13var_dump($a[1]);
14var_dump(a()[1]);
15
16function b() {
17	return new stdClass;
18}
19
20var_dump(b()[1]);
21
22?>
23--EXPECTF--
24Notice: Trying to access array offset on value of type int in %s on line %d
25NULL
26
27Notice: Trying to access array offset on value of type int in %s on line %d
28NULL
29
30Fatal error: Uncaught Error: Cannot use object of type stdClass as array in %s:%d
31Stack trace:
32#0 {main}
33  thrown in %s on line %d
34