#30798 [NEW]: debug_backtrace returns invalid data in some cases
| From: | mikko dot rantalainen at peda dot net | Date: | Mon, 15 Nov 2004 17:31:33 +0000 |
| Subject: | #30798 [NEW]: debug_backtrace returns invalid data in some cases | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-69095@lists.php.net to get a copy of this message | ||
From: mikko dot rantalainen at peda dot net
Operating system: Mandrake Linux 10.0
PHP version: Irrelevant
PHP Bug Type: Reproducible crash
Bug description: debug_backtrace returns invalid data in some cases
Description:
------------
Attached script crashes PHP 4.3.4 (plus security fixes) which is latest
versions distributed with Mandrake Linux.
Reproduce code:
---------------
<?php function __errorHandler($errno, $errstr, $errfile, $errline,
$errcontext)
{
error_log("__errorHandler: $errno: $errstr");
$trace = debug_backtrace();
foreach ($trace as $data)
{
$function = isset($data["function"]) ? $data["function"] : "???";
if ($function == "__errorhandler")
continue; # don't print error handler
$file = isset($data["file"]) ? $data["file"] : "???";
$line = isset($data["line"]) ? $data["line"] : "??";
$args = isset($data["args"]) ? serialize($data["args"]) : ""; # XXX
error_log("$file:$line: $function($args)\n");
}
}
print("<h1>Check log.</h1>");
set_error_handler("__errorHandler");
$parts = split("/",array()); # generate error here
print("EOF.");
?>
Expected result:
----------------
A warning message have been sent to server log and a full page should have
been returned to a client.
Actual result:
--------------
PHP crashes at line marked with "XXX". The problem seems to be related to
the fact that the error is generated with incorrect call to split().
--
Edit bug report at http://bugs.php.net/?id=30798&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30798&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30798&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30798&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=30798&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=30798&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=30798&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=30798&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=30798&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=30798&r=support
Expected behavior: http://bugs.php.net/fix.php?id=30798&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=30798&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=30798&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=30798&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30798&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=30798&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=30798&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=30798&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=30798&r=float
MySQL Configuration Error: http://bugs.php.net/fix.php?id=30798&r=mysqlcfg