From:             iris dot cdm at seznam dot cz
Operating system: Windows XP Proffesional SP2
PHP version:      4.3.8
PHP Bug Type:     Output Control
Bug description:  set_error_handler messes output from debug_backtrace()

Description:
------------
It looks like when we use custom error handler, the output from
debug_backtrace() differs in important parts than with default error
handler used.


Other environment:
Apache 1.3
Zend Engine 1.3.0

Reproduce code:
---------------
<?php

function __error_handler($errno, $errstr, $errfile, $errline,$errcontext)
{ #{{{
    echo '<pre>'; var_dump(debug_backtrace()); die();
} #}}}

set_error_handler('__error_handler');

function wantString($string) {
    return(wantNumber(12345));
}

function wantNumber($number) {
    trigger_error('ok thats error message');
}

wantString('this is a string');

?>

Expected result:
----------------
Expecting output from debug_backtrace with function arguments associated
to proper function.

i.e. (edited few lines from "Actual result")
[2]=>
  array(4) {
    ["file"]=>
    string(51) "d:\_www-nechranene\vyvoj\main-include\test-dbtr.php"
    ["line"]=>
    int(10)
    ["function"]=>
    string(10) "wantnumber"
    ["args"]=>
    &array(1) {
        ["number"]=>
        int(12345)
  }

Actual result:
--------------
Function wantNumber was called with number argument, but here we have it
with string?

array(4) {
  [0]=>
  array(2) {
    ["function"]=>
    string(15) "__error_handler"
    ["args"]=>
    array(5) {
      [0]=>
      &#8747;(1024)
      [1]=>
      &string(22) "ok thats error message"
      [2]=>
      &string(51) "d:\_www-nechranene\vyvoj\main-include\test-dbtr.php"
      [3]=>
      &#8747;(14)
      [4]=>
      &array(1) {
        ["number"]=>
        int(12345)
      }
    }
  }
  [1]=>
  array(3) {
    ["file"]=>
    string(51) "d:\_www-nechranene\vyvoj\main-include\test-dbtr.php"
    ["line"]=>
    int(14)
    ["function"]=>
    string(13) "trigger_error"
  }
  [2]=>
  array(4) {
    ["file"]=>
    string(51) "d:\_www-nechranene\vyvoj\main-include\test-dbtr.php"
    ["line"]=>
    int(10)
    ["function"]=>
    string(10) "wantnumber"
    ["args"]=>
    array(1) {
      [0]=>
      &string(22) "ok thats error message"
    }
  }
  [3]=>
  array(3) {
    ["file"]=>
    string(51) "d:\_www-nechranene\vyvoj\main-include\test-dbtr.php"
    ["line"]=>
    int(17)
    ["function"]=>
    string(10) "wantstring"
  }
}

-- 
Edit bug report at http://bugs.php.net/?id=30711&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=30711&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=30711&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=30711&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=30711&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=30711&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=30711&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=30711&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=30711&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=30711&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=30711&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=30711&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=30711&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=30711&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=30711&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=30711&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=30711&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=30711&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=30711&r=float
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=30711&r=mysqlcfg

Reply via email to