Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:10060 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 49172 invoked by uid 1010); 24 May 2004 08:29:29 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 49115 invoked by uid 1007); 24 May 2004 08:29:29 -0000 Message-ID: <20040524082929.49113.qmail@pb1.pair.com> To: internals@lists.php.net Date: Mon, 24 May 2004 10:29:27 +0200 Lines: 54 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2720.3000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2727.1300 X-Posted-By: 80.35.119.102 Subject: overloading class properties From: su1d@phpclub.net ("Maxx") Hello! Trying to use ZE2's new features for my framework I fell in trouble with (probably) abnormal behaviour of overloaded class properties which has been declared as "expected" long time ago. First of all, I do admit this feature has been discussed before, but despite of all that I apologize for bringing this issue back and I'd like you to pay a bit of your attention to the subject. The problem is following: pub; // no error, but direct access. no __get() call is being made echo $a->pri; // results in Fatal error. no __get() call is being made ?> In neither of two echo'es the call to __get() is being made. Short question: Why is that? Long question: Isn't that clear that when there is a __get() declared in a class, this 'magic' method should be called on ANY access to a class property? Those who want it to behave like it does at the moment, may always emulate desired functionality with Reflection API: function __get($name) { $class = new ReflectionClass(__CLASS__); if($class->getProperty($name)->isPrivate()) trigger_error( ... ); return $this->$name; } ...but, please, give some freedom to those who want it! Let __get()/__set() be called on EVERY attempt to access a property, because the current realization makes Overloading practically USELESS for any serious use, since you don't have a 100% control over accessing to class' properties. Thanks in advance for your time and effort to helping us out with this one. Maxx