ID: 44273
Updated by: [EMAIL PROTECTED]
Reported By: paulscheltema at gmail dot com
-Status: Open
+Status: Feedback
Bug Type: Scripting Engine problem
Operating System: Windows XP / Linux Debian
PHP Version: 5.2.5
New Comment:
Private/protected is about visibility between _classes_ not with a
class cast to an array. So what's the "bug" here?
Previous Comments:
------------------------------------------------------------------------
[2008-02-27 20:49:25] paulscheltema at gmail dot com
Description:
------------
Hello dear developer(s),
When i setup a simple class with a protected/private var,
instanciate the class, and cast the instance to an array
i can access the protected/private var.
Reproduce code:
---------------
class test {
public $public = 'public';
private $private = 'private';
protected $protected = 'protected';
}
$t = new test;
$a = (array)$t;
print '<br>public: '.$a['public'];
print '<br>private: '.$a["\0test\0private"];
print '<br>protected: '.$a["\0*\0protected"];
Expected result:
----------------
Expected:
public: public
Or at most an Error like:
Cannot access private property test::$private
as the value of the private property
Actual result:
--------------
Result:
public: public
private: private
protected: protected
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=44273&edit=1