<?php
class Foo {
private function privateMethod () { echo 'test'; }
public function test () {
Bar::run($this);
}
}
class Bar {
static public function run (\Foo $foo) {
$foo->privateMethod();
}
}
$foo = new Foo;
$foo->test();
Fatal error: Uncaught Error: Call to private method Foo::privateMethod() from scope Bar in /in/0tUXF:12
Stack trace:
#0 /in/0tUXF(6): Bar::run(Object(Foo))
#1 /in/0tUXF(17): Foo->test()
#2 {main}
thrown in /in/0tUXF on line 12
Process exited with code 255.
Fatal error: Uncaught Error: Call to private method Foo::privateMethod() from context 'Bar' in /in/0tUXF:12
Stack trace:
#0 /in/0tUXF(6): Bar::run(Object(Foo))
#1 /in/0tUXF(17): Foo->test()
#2 {main}
thrown in /in/0tUXF on line 12
Process exited with code 255.
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/0tUXF on line 11
Fatal error: Call to private method Foo::privateMethod() from context 'Bar' in /in/0tUXF on line 12
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/0tUXF on line 3
Process exited with code 255.
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/0tUXF on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/0tUXF on line 3
Process exited with code 255.