ID:               33657
 User updated by:  tonvandenheuvel at gmail dot com
 Reported By:      tonvandenheuvel at gmail dot com
 Status:           Wont fix
 Bug Type:         Feature/Change Request
 Operating System: Linux
 PHP Version:      4.4.0
 New Comment:

But then there is no need for debug_backtrace to expose the 'type'
information in the first place?

You're right of course, I should rethink my design.


Previous Comments:
------------------------------------------------------------------------

[2005-07-12 12:37:12] [EMAIL PROTECTED]

You should never have to test if a function is static or not - if you
have to your design is broken.

------------------------------------------------------------------------

[2005-07-12 12:17:56] tonvandenheuvel at gmail dot com

Description:
------------
Currently, I'm using this function to determine whether a function is
called statically:

function IsCalledStatically() {
    $debugBt = debug_backtrace();

    return $debugBt[1]['type'] == '::';
}

Having to rely on the debugger is not very efficient here. Other
methods checking whether $this is set are not fool proof in a situation
where a class' method is called statically from another class method
where $this is defined (possibly within the same class!).



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=33657&edit=1

Reply via email to