]> granicus.if.org Git - php/commitdiff
Fixed Bug #43958 (class name added into the error message)
authorDmitry Stogov <dmitry@php.net>
Tue, 2 Sep 2008 09:46:00 +0000 (09:46 +0000)
committerDmitry Stogov <dmitry@php.net>
Tue, 2 Sep 2008 09:46:00 +0000 (09:46 +0000)
main/main.c
tests/lang/bug43958.phpt [new file with mode: 0644]

index e9fd48554e45f2db81423a0b3e260c9e2291485e..0dc67777e5199a73610664a43e0533830aaa48af 100644 (file)
@@ -668,8 +668,8 @@ PHPAPI void php_verror(const char *docref, const char *params, int type, const c
        char *docref_target = "", *docref_root = "";
        char *p;
        int buffer_len = 0;
-       char *space;
-       zstr class_name = get_active_class_name(&space TSRMLS_CC);
+       char *space = "";
+       zstr class_name = EMPTY_ZSTR;
        int origin_len;
        zstr function = NULL_ZSTR;
        char *origin;
@@ -721,6 +721,8 @@ PHPAPI void php_verror(const char *docref, const char *params, int type, const c
                if (!function.v || !USTR_LEN(function)) {
                        stage = "Unknown";
                        function.v = NULL;
+               } else {
+                       class_name = get_active_class_name(&space TSRMLS_CC);
                }
        }
 
diff --git a/tests/lang/bug43958.phpt b/tests/lang/bug43958.phpt
new file mode 100644 (file)
index 0000000..bc88bcd
--- /dev/null
@@ -0,0 +1,17 @@
+--TEST--
+Bug #43958 (class name added into the error message)
+--FILE--
+<?php
+class MyClass
+{
+       static public function loadCode($p) {
+               return include $p;
+       }
+}
+
+MyClass::loadCode('file-which-does-not-exist-on-purpose.php');
+--EXPECTF--
+Warning: include(file-which-does-not-exist-on-purpose.php): failed to open stream: No such file or directory in %sbug43958.php on line 5
+
+Warning: include(): Failed opening 'file-which-does-not-exist-on-purpose.php' for inclusion (include_path='%s') in %sbug43958.php on line 5
+