You are here: Re: [PHP] Re: Get name of extending class with static method call « PHP « IT news, forums, messages
Re: [PHP] Re: Get name of extending class with static method call

Posted by Morten Rψnseth on 10/03/08 11:05

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:
>>
>>>>
>>>
>>> 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'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.
>
>
> my solution used call_user_func_array(), its relatively slow and a
> ****ing nightmare in terms of complexity.
>
>>
>> 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.
>>>
>>>
>>
>>

 

Navigation:

[Reply to this message]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° Google AdSense  •  England, UK  •  ΡΡ‚Π°Ρ‚ΡŒΠΈ Π½Π° английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация