summaryrefslogtreecommitdiff
path: root/Zend/tests/methods-on-non-objects-nested-calls-new.phpt
blob: d8e3dd21bf4478a852824fafc9d48e78ad399764 (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
--TEST--
Catch method calls on non-objects with nested calls to new
--FILE--
<?php
class Nesting {
}
set_error_handler(function($code, $message) {
  static $i= 0;
  echo 'Called #'.(++$i)."\n";
});

$x= null;
var_dump($x->method(new Nesting()));
var_dump($x->method(new Nesting(), new Nesting()));
var_dump($x->method(new Nesting(new Nesting())));
var_dump($x->method(new Nesting($x->nested())));
var_dump($x->method(new Nesting($x->nested(new Nesting()))));
var_dump($x->method($x->nested(new Nesting($x->deep()))));
var_dump($x->method([new Nesting()]));
echo "Alive\n";
?>
--EXPECTF--
Called #1
NULL
Called #2
NULL
Called #3
NULL
Called #4
NULL
Called #5
NULL
Called #6
NULL
Called #7
NULL
Alive