From: Dmitry Stogov Date: Tue, 15 Nov 2005 11:13:43 +0000 (+0000) Subject: Fixed bug #35176 (include()/require()/*_once() produce wrong error messages about... X-Git-Tag: php-5.1.0RC5~21 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8c100e6451687e9ecb4101b3d645cdc9b4b6bd53;p=php Fixed bug #35176 (include()/require()/*_once() produce wrong error messages about main()) --- diff --git a/NEWS b/NEWS index 2beef5505d..bb6e67f35b 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,8 @@ PHP NEWS - Fixed initializing and argument checking for posix_mknod(). (Derick) - Fixed bug #35197 (Destructor is not called). (Tony) - Fixed bug #35179 (tokenizer extension needs T_HALT_COMPILER). (Greg) +- Fixed bug #35176 (include()/require()/*_once() produce wrong error messages + about main()). (Dmitry) - Fixed bug #35142 (SOAP Client/Server Complex Object Support). (Dmitry) - Fixed bug #35135 (PDOStatment without related PDO object may crash). (Ilia) - Fixed bug #35091 (SoapClient leaks memory). (Dmitry) diff --git a/main/main.c b/main/main.c index 014e4f205e..52e80ea305 100644 --- a/main/main.c +++ b/main/main.c @@ -452,6 +452,33 @@ PHPAPI void php_verror(const char *docref, const char *params, int type, const c function = "PHP Startup"; } else if (php_during_module_shutdown()) { function = "PHP Shutdown"; + } else if (EG(current_execute_data) && + EG(current_execute_data)->opline && + EG(current_execute_data)->opline->opcode == ZEND_INCLUDE_OR_EVAL) { + switch (EG(current_execute_data)->opline->op2.u.constant.value.lval) { + case ZEND_EVAL: + function = "eval"; + is_function = 1; + break; + case ZEND_INCLUDE: + function = "include"; + is_function = 1; + break; + case ZEND_INCLUDE_ONCE: + function = "include_once"; + is_function = 1; + break; + case ZEND_REQUIRE: + function = "require"; + is_function = 1; + break; + case ZEND_REQUIRE_ONCE: + function = "require_once"; + is_function = 1; + break; + default: + function = "Unknown"; + } } else { function = get_active_function_name(TSRMLS_C); if (!function || !strlen(function)) { diff --git a/tests/lang/bug35176.phpt b/tests/lang/bug35176.phpt new file mode 100755 index 0000000000..dd56c76a68 --- /dev/null +++ b/tests/lang/bug35176.phpt @@ -0,0 +1,14 @@ +--TEST-- +Bug #35176 (include()/require()/*_once() produce wrong error messages about main()) +--INI-- +html_errors=1 +error_reporting=4095 +--FILE-- + +--EXPECTF-- +
+Warning: require_once(nonexisiting.php) [function.require-once.html]: failed to open stream: No such file or directory in %sbug35176.php on line 2
+
+Fatal error: require_once() [function.require.html]: Failed opening required 'nonexisiting.php' (%s) in %sbug35176.php on line 2