#26924 [Opn->Bgs]: private methods can be called within a static method

From: Date: Fri, 16 Jan 2004 11:28:04 +0000
Subject: #26924 [Opn->Bgs]: private methods can be called within a static method
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-53421@lists.php.net to get a copy of this message
ID: 26924 Updated by: sniper@php.net Reported By: mike@php.net -Status: Open +Status: Bogus Bug Type: Zend Engine 2 problem Operating System: * PHP Version: 5CVS-2004-01-15 (dev) New Comment: It's all about context..:) Of course you can call private functions within the class they belong to. But you can't call the function from 'outside'. ie. if you tried to call 't::dont();' you'd get that error.. (or maybe I misunderstood this? :) Previous Comments: ------------------------------------------------------------------------ [2004-01-15 13:27:44] mike@php.net Description: ------------ Private class methods can be called by instantiating an object of this class in an static method. Reproduce code: --------------- <?php class t { private function dont() { echo "intended?\n"; } static function main() { $t = new t(); $t->dont(); } } t::main(); ?> Expected result: ---------------- Fatal error: Call to private method t::dont() ... Actual result: -------------- intended? ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=26924&edit=1

« previous php.bugs (#53421) next »