]> 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:45:36 +0000 (09:45 +0000)
committerDmitry Stogov <dmitry@php.net>
Tue, 2 Sep 2008 09:45:36 +0000 (09:45 +0000)
NEWS
main/main.c
tests/lang/bug43958.phpt [new file with mode: 0644]

diff --git a/NEWS b/NEWS
index 332e508f2716b8843c810b826a1c63c4c66568d5..63ddd6670659f879962435e8ac7370ac739aeee8 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -87,6 +87,7 @@ PHP                                                                        NEWS
   (Jani)
 - Fixed bug #43993 (mb_substr_count() behaves differently to substr_count() with
   overlapping needles). (Moriyoshi)
+- Fixed Bug #43958 (class name added into the error message). (Dmitry)
 - Fixed bug #43941 (json_encode silently cuts non-UTF8 strings). (Stas)
 - Fixed bug #43782 (feof() does not detect timeout on socket). (David Soria Parra)
 - Fixed bug #43668 (Added odbc.default_cursortype to control the ODBC
index 533207f1880ee76206fdd2d796d2b6854ec22761..98f0a4902ace462ed056d53694aea0dd8a0fe73d 100644 (file)
@@ -568,8 +568,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;
-       char *class_name = get_active_class_name(&space TSRMLS_CC);
+       char *space = "";
+       char *class_name = "";
        char *function;
        int origin_len;
        char *origin;
@@ -625,6 +625,7 @@ PHPAPI void php_verror(const char *docref, const char *params, int type, const c
                        function = "Unknown";
                } else {
                        is_function = 1;
+                       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
+