File tree Expand file tree Collapse file tree 2 files changed +56
-0
lines changed Expand file tree Collapse file tree 2 files changed +56
-0
lines changed Original file line number Diff line number Diff line change 1+ --TEST--
2+ Dynamic static call to instance method should throw.
3+ --CREDITS--
4+ Aaron Piotrowski <aaron@icicle.io>
5+ --FILE--
6+ <?php
7+ class TestClass
8+ {
9+ private $ test ;
10+
11+ public function method ()
12+ {
13+ $ this ->test = 'test ' ;
14+ return "Hello, world! \n" ;
15+ }
16+ }
17+
18+ $ callback = ['TestClass ' , 'method ' ];
19+ echo $ callback ();
20+ ?>
21+ --EXPECTF--
22+ Deprecated: Non-static method TestClass::method() should not be called statically in %s on line %d
23+
24+ Fatal error: Uncaught Error: Using $this when not in object context in %s:%d
25+ Stack trace:
26+ #0 %s(%d): TestClass::method()
27+ #1 {main}
28+ thrown in %s on line %d
Original file line number Diff line number Diff line change 1+ --TEST--
2+ Dynamic static call to instance method should throw.
3+ --CREDITS--
4+ Aaron Piotrowski <aaron@icicle.io>
5+ --FILE--
6+ <?php
7+ class TestClass
8+ {
9+ private $ test ;
10+
11+ public function method ()
12+ {
13+ $ this ->test = 'test ' ;
14+ return "Hello, world! \n" ;
15+ }
16+ }
17+
18+ $ callback = 'TestClass::method ' ;
19+ echo $ callback ();
20+ ?>
21+ --EXPECTF--
22+ Deprecated: Non-static method TestClass::method() should not be called statically in %s on line %d
23+
24+ Fatal error: Uncaught Error: Using $this when not in object context in %s:%d
25+ Stack trace:
26+ #0 %s(%d): TestClass::method()
27+ #1 {main}
28+ thrown in %s on line %d
You can’t perform that action at this time.
0 commit comments