summaryrefslogtreecommitdiff
path: root/Zend/tests/methods-on-non-objects-array-creation.phpt
blob: 74cbb9c1790bec2315ff360c6e1e7675deeb3720 (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
31
32
33
34
35
--TEST--
Catch method calls on non-objects inside array creation
--FILE--
<?php
set_error_handler(function($code, $message) {
  var_dump($code, $message);
});

$x= null;
var_dump([$x->method() => 'OK']);
var_dump([$x->method(), $x->method(), $x->method()]);
echo "Alive\n";
?>
--EXPECTF--
int(4096)
string(%d) "Call to a member function method() on null"
array(1) {
  [""]=>
  string(2) "OK"
}
int(4096)
string(%d) "Call to a member function method() on null"
int(4096)
string(%d) "Call to a member function method() on null"
int(4096)
string(%d) "Call to a member function method() on null"
array(3) {
  [0]=>
  NULL
  [1]=>
  NULL
  [2]=>
  NULL
}
Alive