ID: 37224 User updated by: Jared dot Williams1 at ntlworld dot com Reported By: Jared dot Williams1 at ntlworld dot com Status: Bogus Bug Type: Scripting Engine problem Operating System: Win2000 PHP Version: 5.1.3RC2 New Comment:
How can the trace containing the function name of one function, and the arguments to another be expected? Previous Comments: ------------------------------------------------------------------------ [2006-05-01 15:04:30] [EMAIL PROTECTED] Expected behaviour. No bug here. ------------------------------------------------------------------------ [2006-04-27 18:24:03] Jared dot Williams1 at ntlworld dot com But more investigation, and it appears that something alters the trace. As args for the [0] element of the trace a what would be expected. Eg: <?php function errorToExceptionHandler($severity, $message, $file, $line) { if (error_reporting() & $severity) throw new ErrorException($message, 0, $severity, $file, $line); } error_reporting(E_ALL & ~(E_NOTICE|E_USER_NOTICE)); set_error_handler('errorToExceptionHandler'); function divr($a, $b) { if ($b >= 1) return divr($a, $b >> 1); return $a / $b; } try { divr(1024, 2); } catch (ErrorException $e) { var_dump($e->getTrace()); } Generates.. array 0 => array 'file' => 'C:\Inetpub\Framework\www\bug.php' (length=32) 'line' => 17 'function' => 'errorToExceptionHandler' (length=23) 'args' => array 0 => 1024 1 => 0 1 => .... ------------------------------------------------------------------------ [2006-04-27 15:18:17] Jared dot Williams1 at ntlworld dot com Description: ------------ The call stack trace includes the name of the function used to map PHP errors to exceptions. And as getTrace() is marked as final, cannot override to exclude this. Reproduce code: --------------- <?php function errorToExceptionHandler($severity, $message, $file, $line) { if (error_reporting() & $severity) throw new ErrorException($message, 0, $severity, $file, $line); } error_reporting(E_ALL & ~(E_NOTICE|E_USER_NOTICE)); set_error_handler('errorToExceptionHandler'); try { $a = 1 / 0; } catch (ErrorException $e) { var_dump($e->getTrace()); } catch (ErrorException $e) { var_dump($e->getTrace()); } Expected result: ---------------- array 0 => array 'file' => 'C:\Inetpub\Framework\www\bug.php' (length=32) 'line' => 14 Actual result: -------------- array 0 => array 'file' => 'C:\Inetpub\Framework\www\bug.php' (length=32) 'line' => 14 'function' => 'errorToExceptionHandler' (length=23) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=37224&edit=1