#31788 [NEW]: __get, __set, __call etc cannot be set private

From: Date: Tue, 01 Feb 2005 02:25:45 +0000
Subject: #31788 [NEW]: __get, __set, __call etc cannot be set private
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-73168@lists.php.net to get a copy of this message
From: davey@php.net Operating system: Irrelevant PHP version: 5.0.3 PHP Bug Type: Zend Engine 2 problem Bug description: __get, __set, __call etc cannot be set private Description: ------------ The magic methods __get, __set, __call and __clone (and maybe others too) cannot be set as private methods when clearly, this is what they should be. They should not be called from outside of the object except by the engine which shouldn't count. Allowing public access to these could cause users to start using them. - Davey Reproduce code: --------------- <?php class foo { private function __get($var) { echo __FUNCTION__ . ' called'; } } $foo = new foo; $foo->bar; ?> Expected result: ---------------- __get called Actual result: -------------- <b>Fatal error</b>: Call to private method foo::__get() from context '' in <b>PHPDocument2</b> on line <b>22</b><br /> -- Edit bug report at http://bugs.php.net/?id=31788&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=31788&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=31788&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=31788&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=31788&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=31788&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=31788&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=31788&r=needscript Try newer version: http://bugs.php.net/fix.php?id=31788&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=31788&r=support Expected behavior: http://bugs.php.net/fix.php?id=31788&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=31788&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=31788&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=31788&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=31788&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=31788&r=dst IIS Stability: http://bugs.php.net/fix.php?id=31788&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=31788&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=31788&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=31788&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=31788&r=mysqlcfg

« previous php.bugs (#73168) next »