]> granicus.if.org Git - php/commitdiff
Fixed bug #70548 (Redundant information printed in case of uncaught engine exception)
authorXinchen Hui <laruence@gmail.com>
Wed, 23 Sep 2015 05:04:33 +0000 (13:04 +0800)
committerXinchen Hui <laruence@gmail.com>
Wed, 23 Sep 2015 05:04:33 +0000 (13:04 +0800)
NEWS
Zend/tests/return_types/028.phpt
Zend/tests/typehints/scalar_return_basic_64bit.phpt
Zend/zend_execute.c

diff --git a/NEWS b/NEWS
index 3bea485f69b451c1fd32d1ee19c42e4b5e04a4a6..ebb26cdab9df2048722f4554787eb16a963a0899 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,8 @@ PHP                                                                        NEWS
 
 - Core:
   . Fixed bug #70555 (fun_get_arg() on unsetted vars return UNKNOW). (Laruence)
+  . Fixed bug #70548 (Redundant information printed in case of uncaught engine
+    exception). (Laruence)
   . Fixed bug #70547 (unsetting function variables corrupts backtrace).
     (Laruence)
   . Fixed bug #70528 (assert() with instanceof adds apostrophes around class
index d2a78ede4abe45d53d4ead60f3889aa95c52453c..8ded158a823c7287a5a8da94ec0a1143d07c15fd 100644 (file)
@@ -12,7 +12,7 @@ function foo(): stdClass {
 try {
        foo();
 } catch (Error $e) {
-       print $e->getMessage();
+       echo $e->getMessage(), " in ", $e->getFile(), " on line ", $e->getLine();
 }
 
 ?>
index 6994817404cac8a1704b7edfc71b3dc8303c4465..fc7401ed24c9e4e4a9e87175618c086f2c88a15a 100644 (file)
@@ -55,7 +55,7 @@ foreach ($functions as $type => $function) {
         try {
             var_dump($function($value));
         } catch (TypeError $e) {
-            echo "*** Caught " . $e->getMessage() . PHP_EOL;
+            echo "*** Caught ", $e->getMessage(), " in ", $e->getFile(), " on line ", $e->getLine(), PHP_EOL;
         }
     }
 }
index 67a6bc2d2793c4d6f448bcd58e0cde47139428c4..10b147394a7ac4b1d511f21c6d1ae8f618273f41 100644 (file)
@@ -926,14 +926,8 @@ static ZEND_COLD void zend_verify_return_error(const zend_function *zf, const ch
                fclass = "";
        }
 
-       if (zf->common.type == ZEND_USER_FUNCTION) {
-               zend_type_error("Return value of %s%s%s() must %s%s, %s%s returned in %s on line %d",
-                       fclass, fsep, fname, need_msg, need_kind, returned_msg, returned_kind,
-                       ZSTR_VAL(zf->op_array.filename), EG(current_execute_data)->opline->lineno);
-       } else {
-               zend_type_error("Return value of %s%s%s() must %s%s, %s%s returned",
-                       fclass, fsep, fname, need_msg, need_kind, returned_msg, returned_kind);
-       }
+       zend_type_error("Return value of %s%s%s() must %s%s, %s%s returned",
+               fclass, fsep, fname, need_msg, need_kind, returned_msg, returned_kind);
 }
 
 static ZEND_COLD void zend_verify_internal_return_error(const zend_function *zf, const char *need_msg, const char *need_kind, const char *returned_msg, const char *returned_kind)