#40056 [NEW]: Member Overloading methods ignore access modifiers

From: Date: Mon, 08 Jan 2007 02:16:20 +0000
Subject: #40056 [NEW]: Member Overloading methods ignore access modifiers
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-107305@lists.php.net to get a copy of this message
From: bugs dot php dot net at andrewprendergast dot com Operating system: Linux Red Hat EL PHP version: 5.2.1RC2 PHP Bug Type: Class/Object related Bug description: Member Overloading methods ignore access modifiers Description: ------------ The access modifiers public & private are ignored when used on the methods __set(), __get(), __isset() & __unset() allowing encapsulation to be breached. Reproduce code: --------------- Refer to example 19-20 http://au.php.net/manual/en/language.oop5.overloading.php Note that even though the __get() and __set() methods are defined as private, they can be invoked from outside the class’s scope (by setting or getting an ‘overloaded’ member variable). Expected result: ---------------- If __get() & __set() are defined private, then attempting to manipulate member variables with them from outside a class's scope should generate an error. Actual result: -------------- No error is generated. -- Edit bug report at http://bugs.php.net/?id=40056&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=40056&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=40056&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=40056&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=40056&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=40056&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=40056&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=40056&r=needscript Try newer version: http://bugs.php.net/fix.php?id=40056&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=40056&r=support Expected behavior: http://bugs.php.net/fix.php?id=40056&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=40056&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=40056&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=40056&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=40056&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=40056&r=dst IIS Stability: http://bugs.php.net/fix.php?id=40056&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=40056&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=40056&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=40056&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=40056&r=mysqlcfg

« previous php.bugs (#107305) next »