ID:               34175
 Updated by:       [EMAIL PROTECTED]
 Reported By:      flummi at everymail dot net
-Status:           Open
+Status:           Closed
 Bug Type:         Scripting Engine problem
 Operating System: Redhat Linux
 PHP Version:      5.0.4


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

[2005-08-22 16:23:06] flummi at everymail dot net

I just tried the latest development version (php5-200508221230) - here
it seems to work quite well, so the bug can be closed, as I can say.
Thanx!

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

[2005-08-17 18:59:45] [EMAIL PROTECTED]

Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip



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

[2005-08-17 18:27:21] flummi at everymail dot net

Description:
------------
When calling debug_backtrace from an own error handler, it provides a
different output than when calling it directly. As you can see in the
code, I have two calls to debug_backtrace, one from my error handler,
the other from a function. As I raise an error shortly after calling
debug_backtrace the first time, I would expect to have the same first
few entries in the debug_backtrace array. I.e. the last entry shows an
error on line 18, where the function 'a_test' is called with arg
'another friend'. In real this function is called with the arg 'friend'
(arg 'another friend' is used in the next function call.
I hope I could explain the bug good enough as my natural language is
german. :-)

Reproduce code:
---------------
<pre>
<?php
function HandleError($n, $m, $f, $l){
  print_r(debug_backtrace());
}
set_error_handler('HandleError');
function a_test($str)
{
   echo "\nHi: $str";
   b_test("another friend");
}
function b_test($str2)
{
   echo "\nHi $str2";
   print_r(debug_backtrace());
   echo "now raise an error..".(2/0);
}
a_test('friend');
?>
</pre>


Expected result:
----------------
Hi: friend
Hi another friendArray
(
    [0] => Array
        (
            [file] => /var/www/html/xiview/test/testerror2.php
            [line] => 10
            [function] => b_test
            [args] => Array
                (
                    [0] => another friend
                )

        )

    [1] => Array
        (
            [file] => /var/www/html/xiview/test/testerror2.php
            [line] => 18
            [function] => a_test
            [args] => Array
                (
                    [0] => friend
                )

        )

)
Array
(
    [0] => Array
        (
            [file] => /var/www/html/xiview/test/testerror2.php
            [line] => 16
            [function] => HandleError
        )

    [1] => Array
        (
            [file] => /var/www/html/xiview/test/testerror2.php
            [line] => 16
            [function] => b_test
        )

    [2] => Array
        (
            [file] => /var/www/html/xiview/test/testerror2.php
            [line] => 10
            [function] => b_test
            [args] => Array
                (
                    [str2] => another friend
                )

        )

    [3] => Array
        (
            [file] => /var/www/html/xiview/test/testerror2.php
            [line] => 18
            [function] => a_test
            [args] => Array
                (
                    [0] => friend
                )

        )

)

Actual result:
--------------
Hi: friend
Hi another friendArray
(
    [0] => Array
        (
            [file] => /var/www/html/xiview/test/testerror2.php
            [line] => 10
            [function] => b_test
            [args] => Array
                (
                    [0] => another friend
                )

        )

    [1] => Array
        (
            [file] => /var/www/html/xiview/test/testerror2.php
            [line] => 18
            [function] => a_test
            [args] => Array
                (
                    [0] => friend
                )

        )

)
Array
(
    [0] => Array
        (
            [file] => /var/www/html/xiview/test/testerror2.php
            [line] => 16
            [function] => HandleError
        )

    [1] => Array
        (
            [file] => /var/www/html/xiview/test/testerror2.php
            [line] => 16
            [function] => b_test
        )

    [2] => Array
        (
            [file] => /var/www/html/xiview/test/testerror2.php
            [line] => 10
            [function] => b_test
            [args] => Array
                (
                    [0] => 2
                    [1] => Division by zero
                    [2] => /var/www/html/xiview/test/testerror2.php
                    [3] => 16
                    [4] => Array
                        (
                            [str2] => another friend
                        )

                )

        )

    [3] => Array
        (
            [file] => /var/www/html/xiview/test/testerror2.php
            [line] => 18
            [function] => a_test
            [args] => Array
                (
                    [0] => another friend
                )

        )

)


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


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

Reply via email to