+
+ /**
+ * Error handler used to track errors that occur during server-side execution of PHP code.
+ * This allows to report back to the client whether an internal error has occurred or not
+ * using an xmlrpc response object, instead of letting the client deal with the html junk
+ * that a PHP execution error on the server generally entails.
+ *
+ * NB: in fact a user defined error handler can only handle WARNING, NOTICE and USER_* errors.
+ */
+ public static function _xmlrpcs_errorHandler($errCode, $errString, $filename = null, $lineNo = null, $context = null)
+ {
+ // obey the @ protocol
+ if (error_reporting() == 0) {
+ return;
+ }
+
+ //if($errCode != E_NOTICE && $errCode != E_WARNING && $errCode != E_USER_NOTICE && $errCode != E_USER_WARNING)
+ if ($errCode != E_STRICT) {
+ \PhpXmlRpc\Server::error_occurred($errString);
+ }
+ // Try to avoid as much as possible disruption to the previous error handling
+ // mechanism in place
+ if (self::$_xmlrpcs_prev_ehandler == '') {
+ // The previous error handler was the default: all we should do is log error
+ // to the default error log (if level high enough)
+ if (ini_get('log_errors') && (intval(ini_get('error_reporting')) & $errCode)) {
+ error_log($errString);
+ }
+ } else {
+ // Pass control on to previous error handler, trying to avoid loops...
+ if (self::$_xmlrpcs_prev_ehandler != array('\PhpXmlRpc\Server', '_xmlrpcs_errorHandler')) {
+ if (is_array(self::$_xmlrpcs_prev_ehandler)) {
+ // the following works both with static class methods and plain object methods as error handler
+ call_user_func_array(self::$_xmlrpcs_prev_ehandler, array($errCode, $errString, $filename, $lineNo, $context));
+ } else {
+ $method = self::$_xmlrpcs_prev_ehandler;
+ $method($errCode, $errString, $filename, $lineNo, $context);
+ }
+ }
+ }
+ }