Find file
Fetching contributors…
Cannot retrieve contributors at this time
42 lines (34 sloc) 742 Bytes
ZE2 A private method cannot be called in a derived class
<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
class pass {
private function show() {
echo "Call show()\n";
protected function good() {
class fail extends pass {
public function ok() {
public function not_ok() {
$t = new fail();
$t->not_ok(); // calling a private function
echo "Done\n"; // shouldn't be displayed
Call show()
Fatal error: Uncaught Error: Call to private method pass::show() from context 'fail' in %s:%d
Stack trace:
#0 %s(%d): fail->not_ok()
#1 {main}
thrown in %s on line %d