xref: /PHP-7.2/Zend/tests/objects_027.phpt (revision f1d7e3ca)
1--TEST--
2Testing 'new static;' calling parent method
3--FILE--
4<?php
5
6class bar {
7	public function show() {
8		var_dump(new static);
9	}
10}
11
12class foo extends bar {
13	public function test() {
14		parent::show();
15	}
16}
17
18$foo = new foo;
19$foo->test();
20$foo::test();
21
22call_user_func(array($foo, 'test'));
23call_user_func(array('foo', 'test'));
24
25?>
26--EXPECTF--
27object(foo)#%d (0) {
28}
29
30Deprecated: Non-static method foo::test() should not be called statically in %s on line %d
31
32Deprecated: Non-static method bar::show() should not be called statically in %s on line %d
33object(foo)#%d (0) {
34}
35object(foo)#%d (0) {
36}
37
38Deprecated: %son-static method foo::test() should not be called statically in %s on line %d
39
40Deprecated: Non-static method bar::show() should not be called statically in %s on line %d
41object(foo)#%d (0) {
42}
43