]> granicus.if.org Git - php/commitdiff
Fixed bug #35176 (include()/require()/*_once() produce wrong error messages about...
authorDmitry Stogov <dmitry@php.net>
Tue, 15 Nov 2005 11:14:34 +0000 (11:14 +0000)
committerDmitry Stogov <dmitry@php.net>
Tue, 15 Nov 2005 11:14:34 +0000 (11:14 +0000)
main/main.c
tests/lang/bug35176.phpt [new file with mode: 0755]

index 3e1dc0750ac16e038e3c9f308483bef8aa867f88..81b9a3138266d87b7ce58cbee2dfa51c6aae047d 100644 (file)
@@ -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 (executable)
index 0000000..dd56c76
--- /dev/null
@@ -0,0 +1,14 @@
+--TEST--
+Bug #35176 (include()/require()/*_once() produce wrong error messages about main())
+--INI--
+html_errors=1
+error_reporting=4095
+--FILE--
+<?php
+require_once('nonexisiting.php');
+?>
+--EXPECTF--
+<br />
+<b>Warning</b>:  require_once(nonexisiting.php) [<a href='function.require-once.html'>function.require-once.html</a>]: failed to open stream: No such file or directory in <b>%sbug35176.php</b> on line <b>2</b><br />
+<br />
+<b>Fatal error</b>:  require_once() [<a href='function.require.html'>function.require.html</a>]: Failed opening required 'nonexisiting.php' (%s) in <b>%sbug35176.php</b> on line <b>2</b><br />