Re: Re: Get name of extending class with static method call
| From: | Morten Rønseth | Date: | Wed, 12 Jan 2005 13:48:28 +0000 |
| Subject: | Re: Re: Get name of extending class with static method call | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-206195@lists.php.net to get a copy of this message | ||
Hi,
I just tried the example code at http://www.zend.com/lists/php-dev/200307/msg00244.html using PHP 5.0.3
The backtrace doesn't see class b at all, all references to it have vanished into thin air.
I spent days trying to solve this on my own until I happened upon this thread - it appears that there is no clean way of retrieving the name of the calling class, in a classmethod defined in the superclass. I do not want to overload the sperclass' method.
I do not accept that this is misusing the static concept - without it, PHP 5 seems rather lame. How does one go about making a feature request? There has to be a way to get this implemented into PHP 5...
Cheers,
-Morten
Jochem Maas wrote:
darn, send button again!! (sent too early) Jochem Maas wrote:Jason Barnett wrote:my solution used call_user_func_array(), its relatively slow and a ****ing nightmare in terms of complexity.I'll put money on that they say "won't do it" and then tell you to read the archives of php-internals as to why. I originally hit this problem when I started to write a PHP5 based framework at the end of 2003. during the time since then I have watched/read quite a few threads on this subject.Indeed! I was actually quite surprised that this wasn't the way __CLASS__ resolved... I had to code it to believe it (and I didn't even do that until after you told us __CLASS__ didn't work!)I would like to thank all of those that cared about my problem and tried to find a solution by providing a wide variety of ideas. Thank you very much!!! Do you think it would be wise to ask for help on php-dev?I strongly suggest you brew a big pot of coffee and sit down for a few (lots??) hours to read thru what has been discussed on php-internals, you might start with:http://www.zend.com/lists/php-dev/200307/msg00242.html basically, AFAIKR, the final answer was something along the lines of - 'your misusing the static class concept' (don't hold me to that tho!)Perhaps the way to go about this would be to make a "feature request" on bugs.php.net? It does seem like something that should be a part of the language.