From: Mikael Nordfeldth Date: Thu, 23 Jun 2016 21:27:18 +0000 (+0200) Subject: Handle exception from Magic Envelope toXML function X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=a4051945fd71a812132febe0e6041775b75cd2ea;p=quix0rs-gnu-social.git Handle exception from Magic Envelope toXML function --- diff --git a/plugins/Diaspora/DiasporaPlugin.php b/plugins/Diaspora/DiasporaPlugin.php index 451d6b904e..c054d3b767 100644 --- a/plugins/Diaspora/DiasporaPlugin.php +++ b/plugins/Diaspora/DiasporaPlugin.php @@ -225,7 +225,12 @@ class DiasporaPlugin extends Plugin public function onSalmonSlap($endpoint_uri, MagicEnvelope $magic_env, Profile $target=null) { - $envxml = $magic_env->toXML($target, 'diaspora'); + try { + $envxml = $magic_env->toXML($target, 'diaspora'); + } catch (Exception $e) { + common_log(LOG_ERR, sprintf('Could not generate Magic Envelope XML (diaspora flavour) for profile id=='.$target->getID().': '.$e->getMessage())); + return false; + } // Diaspora wants another POST format (base64url-encoded POST variable 'xml') $headers = array('Content-Type: application/x-www-form-urlencoded'); diff --git a/plugins/OStatus/OStatusPlugin.php b/plugins/OStatus/OStatusPlugin.php index 9751772fdc..d455f1f478 100644 --- a/plugins/OStatus/OStatusPlugin.php +++ b/plugins/OStatus/OStatusPlugin.php @@ -1407,7 +1407,12 @@ class OStatusPlugin extends Plugin public function onSalmonSlap($endpoint_uri, MagicEnvelope $magic_env, Profile $target=null) { - $envxml = $magic_env->toXML($target); + try { + $envxml = $magic_env->toXML($target); + } catch (Exception $e) { + common_log(LOG_ERR, sprintf('Could not generate Magic Envelope XML for profile id=='.$target->getID().': '.$e->getMessage())); + return false; + } $headers = array('Content-Type: application/magic-envelope+xml');