ID:               41762
 Updated by:       [EMAIL PROTECTED]
 Reported By:      php at kennel17 dot co dot uk
-Status:           Open
+Status:           Bogus
 Bug Type:         Scripting Engine problem
 Operating System: N/A
 PHP Version:      5.2.3
 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Maybe we get a proper implementation for late static binding till then
there is no reliable way to get the information.


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

[2007-06-21 12:41:36] php at kennel17 dot co dot uk

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 this bug report at http://bugs.php.net/?id=41762&edit=1

Reply via email to