php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48960 converting to ErrorException cuts the "message"
Submitted: 2009-07-17 12:46 UTC Modified: 2009-07-17 14:04 UTC
From: shakertest at live dot no Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.3.0 OS: OS X & Ubuntu
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: shakertest at live dot no
New email:
PHP Version: OS:

 

 [2009-07-17 12:46 UTC] shakertest at live dot no
Description:
------------
The exception message of an error that has been converted to an 
ErrorException is getting cut so important information is missing,

Reproduce code:
---------------
function error_handler($code, $message, $file, $line)
{
	throw new ErrorException($message, $code, 0, $file, $line);
}

set_error_handler('error_handler');

function hint(array $foo) {}

try
{
	hint(123);
}
catch(Exception $e)
{
	echo $e->getMessage();
}

Expected result:
----------------
Argument 1 passed to hint() must be an array, integer given, called in 
test.php on line 14 and defined in test.php on line 10

Actual result:
--------------
Argument 1 passed to hint() must be an array, integer given, called in 
test.php on line 14 and defined

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-07-17 13:05 UTC] kalle@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

This is because some errors are meant to be formatted together with a filename and line number to give most sense
 [2009-07-17 14:04 UTC] shakertest at live dot no
How is it not a bug when the message string gets cut?
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 22 21:00:03 2025 UTC