mirror of
https://github.com/php/php-src.git
synced 2024-09-22 02:17:32 +00:00
fix #51394 - try harder to find script lineno when exception happens
This commit is contained in:
parent
49b8860ace
commit
cf4ea31bff
16
Zend/tests/bug51394.phpt
Normal file
16
Zend/tests/bug51394.phpt
Normal file
@ -0,0 +1,16 @@
|
||||
--TEST--
|
||||
Bug #51394 (Error line reported incorrectly if error handler throws an exception)
|
||||
--INI--
|
||||
error_reporting=-1
|
||||
--FILE--
|
||||
<?php
|
||||
function eh()
|
||||
{
|
||||
throw new Exception("error!");
|
||||
return false;
|
||||
}
|
||||
|
||||
set_error_handler("eh");
|
||||
$a = $empty($b);
|
||||
--EXPECTF--
|
||||
Fatal error: Function name must be a string in %sbug51394.php on line 9
|
@ -411,6 +411,10 @@ ZEND_API char *zend_get_executed_filename(TSRMLS_D) /* {{{ */
|
||||
|
||||
ZEND_API uint zend_get_executed_lineno(TSRMLS_D) /* {{{ */
|
||||
{
|
||||
if(EG(exception) && EG(opline_ptr) && active_opline->opcode == ZEND_HANDLE_EXCEPTION &&
|
||||
active_opline->lineno == 0 && EG(opline_before_exception)) {
|
||||
return EG(opline_before_exception)->lineno;
|
||||
}
|
||||
if (EG(opline_ptr)) {
|
||||
return active_opline->lineno;
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user