Return to private_003.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / tests / classes |
1.1 ! misho 1: --TEST-- ! 2: ZE2 A private method cannot be called in a derived class ! 3: --SKIPIF-- ! 4: <?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ! 5: --FILE-- ! 6: <?php ! 7: ini_set("error_reporting",2039); ! 8: class pass { ! 9: private static function show() { ! 10: echo "Call show()\n"; ! 11: } ! 12: ! 13: protected static function good() { ! 14: pass::show(); ! 15: } ! 16: } ! 17: ! 18: class fail extends pass { ! 19: static function ok() { ! 20: pass::good(); ! 21: } ! 22: ! 23: static function not_ok() { ! 24: pass::show(); ! 25: } ! 26: } ! 27: ! 28: fail::ok(); ! 29: fail::not_ok(); // calling a private function ! 30: ! 31: echo "Done\n"; // shouldn't be displayed ! 32: ?> ! 33: --EXPECTF-- ! 34: Call show() ! 35: ! 36: Fatal error: Call to private method pass::show() from context 'fail' in %s on line %d