ID:               34986
 User updated by:  [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
 Status:           Open
 Bug Type:         Feature/Change Request
 Operating System: Irrelevant
 PHP Version:      5.1.0RC3
 New Comment:

Just a clarification: [object] should contain a reference to the
object, not an "Object id #x" string. That is only in the example
output as that is what would happen for print_r(debug_backtrace()).


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

[2005-10-26 06:53:59] [EMAIL PROTECTED]

Description:
------------
For some Meta Programming it would be great if debug_backtrace() could
return an [object] field (in addition to [class] that contains a
reference to respective object.

Reproduce code:
---------------
<?php
class A {
  private $b;

  public function __construct()  {
    $this->b = new B;
  }

  public function aMethod() {
    $this->b->bMethod();
  }
}

class B {
  public function bMethod() {
    print_r(debug_backtrace());
  }
}

$a = new A;
$a->aMethod();
?>

Expected result:
----------------
Array
(
    [0] => Array
        (
            [file] => /home/sb/test.php
            [line] => 10
            [function] => bMethod
            [class] => B
            [object] => <Object id #2>
            [type] => ->
            [args] => Array
                (
                )

        )

    [1] => Array
        (
            [file] => /home/sb/test.php
            [line] => 21
            [function] => aMethod
            [class] => A
            [object] => <Object id #1>
            [type] => ->
            [args] => Array
                (
                )

        )

)

Actual result:
--------------
Array
(
    [0] => Array
        (
            [file] => /home/sb/test.php
            [line] => 10
            [function] => bMethod
            [class] => B
            [type] => ->
            [args] => Array
                (
                )

        )

    [1] => Array
        (
            [file] => /home/sb/test.php
            [line] => 21
            [function] => aMethod
            [class] => A
            [type] => ->
            [args] => Array
                (
                )

        )

)


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


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

Reply via email to