summaryrefslogtreecommitdiff
path: root/Zend/tests/dereference_010.phpt
blob: 16c76eb77706cdbb32d60f914666e116a86a0c89 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
--TEST--
Testing dereference in non-array values
--FILE--
<?php

error_reporting(E_ALL);

function a() {
	return 1;
}

$a = 1;
var_dump($a[1]);
var_dump(a()[1]);

function b() {
	return new stdClass;
}

var_dump(b()[1]);

?>
--EXPECTF--
NULL
NULL

Fatal error: Uncaught exception 'EngineException' with message 'Cannot use object of type stdClass as array' in %s:%d
Stack trace:
#0 {main}
  thrown in %s on line %d