Return to bug22725.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / Zend / tests |
1.1 ! misho 1: --TEST-- ! 2: Bug #22725 (A derived class can call a parent's protected method that calls a private method) ! 3: --SKIPIF-- ! 4: <?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ! 5: --FILE-- ! 6: <?php ! 7: class Foo { ! 8: private function aPrivateMethod() { ! 9: echo "Foo::aPrivateMethod() called.\n"; ! 10: } ! 11: ! 12: protected function aProtectedMethod() { ! 13: echo "Foo::aProtectedMethod() called.\n"; ! 14: $this->aPrivateMethod(); ! 15: } ! 16: } ! 17: ! 18: class Bar extends Foo { ! 19: public function aPublicMethod() { ! 20: echo "Bar::aPublicMethod() called.\n"; ! 21: $this->aProtectedMethod(); ! 22: } ! 23: } ! 24: ! 25: $o = new Bar; ! 26: $o->aPublicMethod(); ! 27: ?> ! 28: --EXPECT-- ! 29: Bar::aPublicMethod() called. ! 30: Foo::aProtectedMethod() called. ! 31: Foo::aPrivateMethod() called.