#40056 [Opn->Bgs]: Member Overloading methods ignore access modifiers
| From: | iliaa@php.net | Date: | Mon, 08 Jan 2007 03:07:09 +0000 |
| Subject: | #40056 [Opn->Bgs]: Member Overloading methods ignore access modifiers | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-107306@lists.php.net to get a copy of this message | ||
ID: 40056
Updated by: iliaa@php.net
Reported By: bugs dot php dot net at andrewprendergast dot com
-Status: Open
+Status: Bogus
Bug Type: Class/Object related
Operating System: Linux Red Hat EL
PHP Version: 5.2.1RC2
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
The reasons this works is because the methods are not called
directly but rather internally by the class handler. Because
they are called by the class handler private/protected check
works.
Previous Comments:
------------------------------------------------------------------------
[2007-01-08 02:16:20] bugs dot php dot net at andrewprendergast dot com
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 classs 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 this bug report at http://bugs.php.net/?id=40056&edit=1