php-src/Zend/tests/bug22725.phpt

30 lines
654 B
Plaintext
Raw Normal View History

2003-06-02 02:35:29 +08:00
--TEST--
2007-05-08 00:50:40 +08:00
Bug #22725 (A derived class can call a parent's protected method that calls a private method)
2003-06-02 02:35:29 +08:00
--FILE--
<?php
class Foo {
private function aPrivateMethod() {
echo "Foo::aPrivateMethod() called.\n";
}
protected function aProtectedMethod() {
echo "Foo::aProtectedMethod() called.\n";
$this->aPrivateMethod();
}
}
class Bar extends Foo {
public function aPublicMethod() {
echo "Bar::aPublicMethod() called.\n";
$this->aProtectedMethod();
}
}
$o = new Bar;
$o->aPublicMethod();
?>
--EXPECT--
Bar::aPublicMethod() called.
Foo::aProtectedMethod() called.
Foo::aPrivateMethod() called.