|
Posted by Jason Barnett on 10/14/65 11:05
>
> By "tunnelling" the call through Porsche's own drive() method
> debug_backtrace() will contain two traces, one of them with the correct
> class name.
>
> I tried using reflection but "reflecting" car by using __CLASS__ doesn't
> give any information about the classes that extend it. So this doesn't work
> either.
Right... the root issue here seems to be that everything is relying on
the __CLASS__ macro, but this macro behaves differently than what you
expected (a la debug_backtrace in PHP4)
>
> Rory's proposed way of reading in the file contents and preg_matching the
> method name works, but it's very, very ugly, indeed! ;)
>
> Isn't it somewhat ridiculous that there is no *easy* way in PHP5 to achieve
> what I consider to be a pretty straightforward requirement?:
>
> "Get name of the class that invoked a static call of an inherited method"
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?
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.
--
Teach a person to fish...
Ask smart questions: http://www.catb.org/~esr/faqs/smart-questions.html
PHP Manual: http://www.php.net/manual/en/index.php
php-general archives: http://marc.theaimsgroup.com/?l=php-general&w=2
Navigation:
[Reply to this message]
|