ID:               29896
 Comment by:       flying at dom dot natm dot ru
 Reported By:      terry at pothecary dot com
 Status:           Open
 Bug Type:         Zend Engine 2 problem
 Operating System: Windows 2000
 PHP Version:      5.0.1
 New Comment:

I can confirm this bug still available into newly released PHP 5.0.2.
Besides mentioned problem of functions agruments shifting there is also
a problem with arguments substitution for a function, where error
occurs. Here is example code and backtrace results print:

Script 
======

<?php
function err()
{
    echo debug_print_backtrace();
};

set_error_handler('err');

function a()
{
    b('arg-b');
};

function b()
{
    c('arg-c');
};

function c()
{
    $a = 1/0;
};

a('arg-a');
?>

debug_print_backtrace() output
==============================
#0 err() called at [c:\test.php:21] 
#1 c() called at [c:\test.php:21] 
#2 c(2, Division by zero, c:\test.php, 21, Array ()) called at
[c:\test.php:16] 
#3 b(arg-c) called at [c:\test.php:11] 
#4 a(arg-b) called at [c:\test.php:24] 
Array

Expected results
================
1. line #1 should not be here
2. line #2 should have actual argument 'arg-a' instead of listed
arguments, which are actually passed to error handler function
3. It is not clear for me where 'Array' word is came from on last line


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

[2004-08-30 14:14:39] terry at pothecary dot com

Description:
------------
If you call and enumerate the information from a debug_backtrace() in a
user error handler then the argument list is out of step with the other
information.

Reproduce code:
---------------
function userErrorHandler($num, $msg, $file, $line, $vars)
{
    debug_print_backtrace();
}

$OldErrorHandler = set_error_handler("userErrorHandler");


function GenerateError1($A1)
{
    $a = $b;
}

function GenerateError2($A1)
{
    GenerateError1("Test1");
}

GenerateError2("Test2");


Expected result:
----------------
I expect the final line in the backtrace to show a call of:
GenerateError2(Test2)


Actual result:
--------------
The final line in the backtrace shows a call of:
GenerateError2(Test1)



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


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

Reply via email to