From 1adbae673c071a939b0703cd90ed81c9fc291819 Mon Sep 17 00:00:00 2001 From: donal72 Date: Fri, 2 Nov 2007 00:13:42 +0000 Subject: [PATCH] Propagate additional error info about XML parse failures --- mnet/xmlrpc/client.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/mnet/xmlrpc/client.php b/mnet/xmlrpc/client.php index 39ea60dbc5..ed92f3f44a 100644 --- a/mnet/xmlrpc/client.php +++ b/mnet/xmlrpc/client.php @@ -249,7 +249,22 @@ class mnet_xmlrpc_client { } } else { - $this->error[] = '1:Payload not encrypted '; + + if (! empty($crypt_parser->error)) { + $crypt_parser_error = $crypt_parser->error[0]; + + $message = '3:XML Parse error in payload: '.$crypt_parser_error['string']."\n"; + if (array_key_exists('lineno', $crypt_parser_error)) { + $message .= 'At line number: '.$crypt_parser_error['lineno']."\n"; + } + if (array_key_exists('line', $crypt_parser_error)) { + $message .= 'Which reads: '.$crypt_parser_error['line']."\n"; + } + $this->error[] = $message; + } else { + $this->error[] = '1:Payload not encrypted '; + } + $crypt_parser->free_resource(); return false; } -- 2.39.5