Two class methods with same name (WAS: [PEAR-DEV] dirname(__FILE__))
| From: | Ondrej Jombik | Date: | Fri, 25 Oct 2002 09:21:07 +0000 |
| Subject: | Two class methods with same name (WAS: [PEAR-DEV] dirname(__FILE__)) | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-10289@lists.php.net to get a copy of this message | ||
Maxim, 11:11:58
25. oktober 2002 (piatok)
Greetings.
> Is it normal that I can in fact declare functions with the same name
> multiple times as long as they´re contained in a class, even if it´s the
> same class? I noticed that PHP will not throw any error, but use the last
> function that was declared instead, overwriting the other ones. When I do
> this outside of a class the parser exits with an error - and that´s the
> way it should be, IMHO. Or is it just a bug in PHP?
You can even resursivelly call class method itself to cause SIGSEGV
of some versions of PHP interpreter. More info on:
http://bugs.php.net/?id=18074
What does have these two things mutual? They came from bad class/app
design and IMHO won't be fixed in future. But anyway, you can report it via
bugs.php.net to get official PHP developer's standing.
=Nepto=
____________________________________________________________________________
Ondrej 'Nepto' Jombik, http://www.nepto.sk/
nepto@atomicpile.sk