#33657 [NEW]: Function to determine whether a method is called statically

From: Date: Tue, 12 Jul 2005 10:17:57 +0000
Subject: #33657 [NEW]: Function to determine whether a method is called statically
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-81721@lists.php.net to get a copy of this message
From: tonvandenheuvel at gmail dot com Operating system: Linux PHP version: 4.4.0 PHP Bug Type: Feature/Change Request Bug description: Function to determine whether a method is called statically 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 bug report at http://bugs.php.net/?id=33657&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33657&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33657&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33657&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=33657&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=33657&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=33657&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=33657&r=needscript Try newer version: http://bugs.php.net/fix.php?id=33657&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=33657&r=support Expected behavior: http://bugs.php.net/fix.php?id=33657&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=33657&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=33657&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=33657&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33657&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=33657&r=dst IIS Stability: http://bugs.php.net/fix.php?id=33657&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=33657&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=33657&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=33657&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=33657&r=mysqlcfg

« previous php.bugs (#81721) next »