ID:               30711
 Comment by:       john_mash02 at yahoo dot co dot uk
 Reported By:      iris dot cdm at seznam dot cz
 Status:           Open
 Bug Type:         Output Control
 Operating System: Windows XP Proffesional SP2
 PHP Version:      4.3.8
 New Comment:

It's almost a month ago and no one from PHP developers does not
know???

Johny


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

[2004-11-07 12:15:23] iris dot cdm at seznam dot cz

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 this bug report at http://bugs.php.net/?id=30711&edit=1

Reply via email to