From 8d95106b9df9aba4146b29170f9f979191bc9295 Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 25 Sep 2017 21:34:44 +0000 Subject: [PATCH] XML parsing is more tolerant now --- include/diaspora.php | 8 ++++---- include/network.php | 17 ++++++----------- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/include/diaspora.php b/include/diaspora.php index 5ecbfa4dc7..3313314ca1 100644 --- a/include/diaspora.php +++ b/include/diaspora.php @@ -118,7 +118,7 @@ class Diaspora { */ private static function verify_magic_envelope($envelope) { - $basedom = parse_xml_string($envelope, false); + $basedom = parse_xml_string($envelope); if (!is_object($basedom)) { logger("Envelope is no XML file"); @@ -309,7 +309,7 @@ class Diaspora { $decrypted = self::aes_decrypt($outer_key, $outer_iv, $ciphertext); logger('decrypted: '.$decrypted, LOGGER_DEBUG); - $idom = parse_xml_string($decrypted,false); + $idom = parse_xml_string($decrypted); $inner_iv = base64_decode($idom->iv); $inner_aes_key = base64_decode($idom->aes_key); @@ -556,7 +556,7 @@ class Diaspora { */ private static function valid_posting($msg) { - $data = parse_xml_string($msg["message"], false); + $data = parse_xml_string($msg["message"]); if (!is_object($data)) { logger("No valid XML ".$msg["message"], LOGGER_DEBUG); @@ -1153,7 +1153,7 @@ class Diaspora { return false; } - $source_xml = parse_xml_string($x, false); + $source_xml = parse_xml_string($x); if (!is_object($source_xml)) return false; diff --git a/include/network.php b/include/network.php index 4b1ddab033..0319468517 100644 --- a/include/network.php +++ b/include/network.php @@ -620,20 +620,15 @@ function avatar_img($email) { } -function parse_xml_string($s,$strict = true) { +function parse_xml_string($s, $strict = true) { + // the "strict" parameter is deactivated + /// @todo Move this function to the xml class - if ($strict) { - if (! strstr($s,'code." at ".$err->line.":".$err->column." : ".$err->message, LOGGER_DATA); }