[PHP-BUG] Bug #51394 [NEW]: Error line reported incorrectly iif error handler throws an exception

[email protected] ("stas at zend dot com")
Newsgroups php.bugs
Message-ID <[email protected]>
From:             
Operating system: *
PHP version:      5.3SVN-2010-03-25 (SVN)
Package:          Scripting Engine problem
Bug Type:         Bug
Bug description:Error line reported incorrectly iif error handler throws an exception

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

-- 
Edit bug report at http://bugs.php.net/bug.php?id=51394&edit=1
-- 
Try a snapshot (PHP 5.2):            http://bugs.php.net/fix.php?id=51394&r=trysnapshot52
Try a snapshot (PHP 5.3):            http://bugs.php.net/fix.php?id=51394&r=trysnapshot53
Try a snapshot (PHP 6.0):            http://bugs.php.net/fix.php?id=51394&r=trysnapshot60
Fixed in SVN:                        http://bugs.php.net/fix.php?id=51394&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=51394&r=needdocs
Fixed in release:                    http://bugs.php.net/fix.php?id=51394&r=alreadyfixed
Need backtrace:                      http://bugs.php.net/fix.php?id=51394&r=needtrace
Need Reproduce Script:               http://bugs.php.net/fix.php?id=51394&r=needscript
Try newer version:                   http://bugs.php.net/fix.php?id=51394&r=oldversion
Not developer issue:                 http://bugs.php.net/fix.php?id=51394&r=support
Expected behavior:                   http://bugs.php.net/fix.php?id=51394&r=notwrong
Not enough info:                     http://bugs.php.net/fix.php?id=51394&r=notenoughinfo
Submitted twice:                     http://bugs.php.net/fix.php?id=51394&r=submittedtwice
register_globals:                    http://bugs.php.net/fix.php?id=51394&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=51394&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=51394&r=dst
IIS Stability:                       http://bugs.php.net/fix.php?id=51394&r=isapi
Install GNU Sed:                     http://bugs.php.net/fix.php?id=51394&r=gnused
Floating point limitations:          http://bugs.php.net/fix.php?id=51394&r=float
No Zend Extensions:                  http://bugs.php.net/fix.php?id=51394&r=nozend
MySQL Configuration Error:           http://bugs.php.net/fix.php?id=51394&r=mysqlcfg
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.