From: gggeek Date: Sat, 30 May 2015 11:48:28 +0000 (+0200) Subject: Correctly reset php error handler even when user-code raises an exception X-Git-Tag: 4.0.0-alpha^2~25 X-Git-Url: http://git.onelab.eu/?p=plcapi.git;a=commitdiff_plain;h=4f055f25ad547e9faf94417dfd58c2082e8e31f1 Correctly reset php error handler even when user-code raises an exception --- diff --git a/NEWS b/NEWS index 8d8c130..5880306 100644 --- 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 diff --git a/src/Server.php b/src/Server.php index 96aac17..70b45de 100644 --- a/src/Server.php +++ b/src/Server.php @@ -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: