php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30798 debug_backtrace returns invalid data in some cases
Submitted: 2004-11-15 18:31 UTC Modified: 2005-01-28 10:52 UTC
From: mikko dot rantalainen at peda dot net Assigned:
Status: Closed Package: Reproducible crash
PHP Version: 4.3.9 OS: Mandrake Linux 10.0
Private report: No CVE-ID: None
 [2004-11-15 18:31 UTC] mikko dot rantalainen at peda dot net
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().


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-11-15 18:40 UTC] derick@php.net
Thank you for taking the time to report a problem with PHP.
Unfortunately you are not using a current version of PHP -- 
the problem might already be fixed. Please download a new
PHP version from http://www.php.net/downloads.php

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.

.
 [2005-01-28 10:52 UTC] mikko dot rantalainen at peda dot net
I just checked this problem again. The reproduce code segfaults 4.3.9 but works with 4.3.10. Marking as closed.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sat Dec 14 09:01:24 2019 UTC