summaryrefslogtreecommitdiff
path: root/Zend/tests/methods-on-non-objects-as-arg.phpt
blob: 13b83cb06ef54c461d99fa186b4f65defb4613db (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
36
37
38
39
40
41
42
43
44
45
46
47
--TEST--
Catch method calls on non-objects as argument
--FILE--
<?php
function nesting() {
  return func_get_args();
}
set_error_handler(function($code, $message) {
  static $i= 0;
  echo 'Called #'.(++$i)."\n";
});

$x= null;
var_dump(nesting($x->method()));
var_dump(nesting(nesting($x->method())));
var_dump(nesting($x->method(nesting($x->method()))));
var_dump(nesting($x->method(), $x->method()));
echo "Alive\n";
?>
--EXPECTF--
Called #1
array(1) {
  [0]=>
  NULL
}
Called #2
array(1) {
  [0]=>
  array(1) {
    [0]=>
    NULL
  }
}
Called #3
array(1) {
  [0]=>
  NULL
}
Called #4
Called #5
array(2) {
  [0]=>
  NULL
  [1]=>
  NULL
}
Alive