From: php at kennel17 dot co dot uk
Operating system: N/A
PHP version: 5.2.3
PHP Bug Type: Unknown/Other Function
Bug description: Fix of bug #30828 means there is no way to get class name
statically.
Description:
------------
Before bug #30828 was fixed, debug_backtrace() could be used to get the
name of a class when the class was extended from a parent class and being
called statically. The new change removes this functionality, and as far
as I can see there is no replacement. Perhaps, I am just unaware of an
alternative method of achieving this, but if not then this is a vital piece
of functionality that has gone missing!
Reproduce code:
---------------
<?php
function get_class_static() {
$bt = debug_backtrace();
if (isset($bt[1]['object']))
return get_class($bt[1]['object']);
else
return $bt[1]['class'];
}
class foo {
function printClassName() {
print(get_class_static() . "<br>");
}
}
class bar extends foo {
}
foo::printClassName();
bar::printClassName();
?>
Expected result:
----------------
In PHP4 the output was:
foo
bar
Actual result:
--------------
In PHP5 the output is:
foo
foo
--
Edit bug report at http://bugs.php.net/?id=41762&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=41762&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=41762&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=41762&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=41762&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=41762&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=41762&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=41762&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=41762&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=41762&r=support
Expected behavior: http://bugs.php.net/fix.php?id=41762&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=41762&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=41762&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=41762&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=41762&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=41762&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=41762&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=41762&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=41762&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=41762&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=41762&r=mysqlcfg