|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2003-07-28 13:59 UTC] sfox@php.net
[2003-07-28 17:49 UTC] Bertrand dot Willm at laposte dot net
[2003-07-28 18:50 UTC] alan at akbkhome dot com
[2003-10-16 05:03 UTC] helly@php.net
[2004-05-30 14:43 UTC] stas@php.net
[2004-05-31 23:14 UTC] helly@php.net
[2004-07-13 16:16 UTC] de_bruut at hotmail dot com
[2004-11-04 15:45 UTC] thekid@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 08:00:01 2025 UTC |
Description: ------------ I want to have access to private or protected member throw __get and __set method to control the access or just to let a read access to this member (and then __set is not used). To do that I have to choose an other name for this property. I can't use the same name as the private member. PHP could test if there is __get or __set method and use them before telling ther is an error. Reproduce code: --------------- <?php class CBaseClass { private $var = 'default'; function __get($name) { return $this->var; } } $object = new CBaseClass(); echo $object->var; ?> Expected result: ---------------- default Actual result: -------------- Fatal error: Cannot access private property cbaseclass::$var in c:\sitesweb\www\test.php5 on line 11