Error line reported incorrectly iif error handler throws an exception

Bug #51394 Error line reported incorrectly iif error handler throws an exception
Submitted: 2010-03-25 21:31 UTC Modified: 2010-04-01 21:37 UTC
From: stas at zend dot com Assigned: stas (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 5.3SVN-2010-03-25 (SVN) OS: *
Private report: No CVE-ID: None

 [2010-03-25 21:31 UTC] stas at zend dot com

Description:
------------
The test script code produces the following error:

[25-Mar-2010 13:25:29] PHP Fatal error:  Function name must be a string in test.php on line 0

This is because there's actually two errors:
1. Undefined $empty notice
2. Function name must be string - fatal error

When error (1) is processed, due to the exception opline_ptr is set to the exception handler opcode, so when the engine wants to report error (2) it doesn't have proper opline_ptr to report the error. 

Test script:
---------------
<?php
function eh()
{
	throw new Exception("error!");
	return false;
}

set_error_handler("eh");
$a = $empty($b);

Expected result:
----------------
[25-Mar-2010 13:25:29] PHP Fatal error:  Function name must be a string in test.php on line 9

Actual result:
--------------
[25-Mar-2010 13:25:29] PHP Fatal error:  Function name must be a string in test.php on line 0

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports

 [2010-04-01 21:37 UTC] stas@php.net

-Status: Open +Status: Closed -Assigned To: +Assigned To: stas

 [2010-04-01 21:37 UTC] stas@php.net

This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.