php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40056 Member Overloading methods ignore access modifiers
Submitted: 2007-01-08 02:16 UTC Modified: 2007-01-08 03:07 UTC
From: bugs dot php dot net at andrewprendergast dot com Assigned:
Status: Not a bug Package: Class/Object related
PHP Version: 5.2.1RC2 OS: Linux Red Hat EL
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: bugs dot php dot net at andrewprendergast dot com
New email:
PHP Version: OS:

 

 [2007-01-08 02:16 UTC] 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 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.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-01-08 03:07 UTC] iliaa@php.net
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.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Jul 05 22:01:31 2024 UTC