Re: __call() magic method
| From: | Diogo Neves | Date: | Sat, 30 Aug 2008 23:17:41 +0000 |
| Subject: | Re: __call() magic method | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-40177@lists.php.net to get a copy of this message | ||
Hi again,
On Sun, Aug 31, 2008 at 12:04 AM, Antony Dovgal <tony@daylessday.org> wrote:
> On 31.08.2008 02:50, Diogo Neves wrote:
>>
>> Exactly...
>>
>> Is that normal workings or more like a bugie one?
>
> Definitely not a bug.
Ok, it's implemented to work like that... less bad ;)
>
> I believe the reason is that if you enable __call() in this case, you'd have
> different behavior depending on the calling scope, i.e. complete mess.
Well, if things don't behave diferent depending on scope then why
private exists anyway?
And the scope is being controlled already, that's why i get an fatal
error, right?
If the method is private, why it simple don't "think" it doesn't exist
when outside of class scope?
Maybe it don't make sense but...
class foo {
private function bar() { }
function __call($f,$a) {
echo "called $f";
}
}
$a = new foo;
// There ( ouside the class scope ) ...
// ... this exist as much ...
$a->bar();
// ... as this, right?
$a->bar1();
Even if it looks like a mess... it makes some sense, no?
Unless u say me that a class isn't a scope because I never understood
the php scopes, maybe u can recomend me a good article about it or
some link somewhere
> Also there would be no way to know you're calling a method you're not
> supposed to call (unless you trigger an error yourself).
>
> --
> Wbr, Antony Dovgal
>
--
Thanks by your attention,
Diogo Neves
Web Developer @ SAPO.pt by PrimeIT.pt