[PHP] debug_backtrace bug?

2004-11-17 Thread Thomas Peri
I wanted to run this past the list before submitting a bug report.  
(I've searched the bugs and haven't found anything relevant to my 
problem.)

The problem is that when s method of one class is overridden in a 
subclass, debug_backtrace() doesn't distinguish between the two 
methods.  For example, this code:

class A {
function __construct() {
$bt = debug_backtrace();
foreach ($bt as $t)
print $t['class']."::".$t['function']."";
}
}

class B extends A {
function __construct() {
parent::__construct();
}
}

$b = new B();
...produces this output:
B::__construct
B::__construct
...instead of the output I'd expect:
A::__construct
B::__construct
It happens for regular methods also, not just constructors.  Is this a 
bug, or is this behavior correct for some reason?  (Tested in php 
5.0.0, 5.0.1, and 5.0.2)

Thanks.
Thomas
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] determining caller of function

2004-11-24 Thread Thomas Peri
Is there a way, *other than using debug_backtrace(), which has a bug*, 
to determine from inside what class and method the current function was 
called?  For example:

class Foo {
   function fubar() {
  // I want to be able to determine that the function from which this
  // method was called in this example is the "go" method of the 
class "Bar".
   }
}
class Bar{
   function go() {
  $f = new Foo();
  $f->fubar();
   }
}
$b = new Bar();
$b->go();

--
Thanks,
- Thomas
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php