Correctly reset php error handler even when user-code raises an exception
authorgggeek <giunta.gaetano@gmail.com>
Sat, 30 May 2015 11:48:28 +0000 (13:48 +0200)
committergggeek <giunta.gaetano@gmail.com>
Sat, 30 May 2015 11:48:28 +0000 (13:48 +0200)
NEWS
src/Server.php

diff --git a/NEWS b/NEWS
index 8d8c130..5880306 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -47,6 +47,11 @@ PLEASE READ CAREFULLY THE NOTES BELOW to insure a smooth upgrade.
 
 * improved: more tests in the test suite
 
+* fixed: the server would not reset the user-set debug messages between subsequent service() calls
+
+* fixed: the server would not reset previous php error handlers when an exception was thrown by user code and
+  exception_handling set to 2
+
 * fixed: the server would fail to decode a request with ISO-8859-1 payload and character set declaration in the xml
   prolog only
 
index 96aac17..70b45de 100644 (file)
@@ -678,6 +678,13 @@ class Server
             // in the called function, we wrap it in a proper error-response
             switch ($this->exception_handling) {
                 case 2:
+                    if ($this->debug > 2) {
+                        if (self::$_xmlrpcs_prev_ehandler) {
+                            set_error_handler(self::$_xmlrpcs_prev_ehandler);
+                        } else {
+                            restore_error_handler();
+                        }
+                    }
                     throw $e;
                     break;
                 case 1: