From: Dmitry Stogov Date: Tue, 15 Nov 2005 11:14:34 +0000 (+0000) Subject: Fixed bug #35176 (include()/require()/*_once() produce wrong error messages about... X-Git-Tag: RELEASE_2_0_1~9 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1f98519ac4b1d1bed2d7cfd75e48157b30e1ddfd;p=php Fixed bug #35176 (include()/require()/*_once() produce wrong error messages about main()) --- diff --git a/main/main.c b/main/main.c index 3e1dc0750a..81b9a31382 100644 --- a/main/main.c +++ b/main/main.c @@ -570,6 +570,28 @@ PHPAPI void php_verror(const char *docref, const char *params, int type, const c stage = "PHP Startup"; } else if (php_during_module_shutdown()) { stage = "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"; + break; + case ZEND_INCLUDE: + function = "include"; + break; + case ZEND_INCLUDE_ONCE: + function = "include_once"; + break; + case ZEND_REQUIRE: + function = "require"; + break; + case ZEND_REQUIRE_ONCE: + function = "require_once"; + break; + default: + stage = "Unknown"; + } } else { function = get_active_function_name(TSRMLS_C); if (!function || !USTR_LEN(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