<?php
class Foo {
private function thing() {
var_dump('asdf');
}
}
class Bar extends Foo {
public function getThing() {
$this->thing();
}
}
class Baz extends Foo {
private function thing() {
var_dump('qwer');
}
public function getThing() {
$this->thing();
}
}
$bar = new Bar();
$bar->getThing();
$baz = new Baz();
$baz->getThing();
Fatal error: Uncaught Error: Call to private method Foo::thing() from scope Bar in /in/TNKbS:9
Stack trace:
#0 /in/TNKbS(22): Bar->getThing()
#1 {main}
thrown in /in/TNKbS on line 9
Process exited with code 255.
Fatal error: Uncaught Error: Call to private method Foo::thing() from context 'Bar' in /in/TNKbS:9
Stack trace:
#0 /in/TNKbS(22): Bar->getThing()
#1 {main}
thrown in /in/TNKbS on line 9
Process exited with code 255.
Fatal error: Call to private method Foo::thing() from context 'Bar' in /in/TNKbS on line 9
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/TNKbS 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/TNKbS 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/TNKbS on line 3
Process exited with code 255.