From cba9de39a4637376d5e06e2a909d0904f443868d Mon Sep 17 00:00:00 2001 From: gggeek Date: Sat, 23 May 2015 23:13:56 +0100 Subject: [PATCH] Make sure all error messages have the method name --- src/Helper/Charset.php | 2 +- src/Helper/XMLParser.php | 12 ++++++------ src/Server.php | 1 - 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/Helper/Charset.php b/src/Helper/Charset.php index a4064d8..9000ffb 100644 --- a/src/Helper/Charset.php +++ b/src/Helper/Charset.php @@ -203,7 +203,7 @@ class Charset */ default: $escapedData = ''; - error_log("Converting from $srcEncoding to $destEncoding: not supported..."); + error_log('XML-RPC: ' . __METHOD__ . ": Converting from $srcEncoding to $destEncoding: not supported..."); } return $escapedData; diff --git a/src/Helper/XMLParser.php b/src/Helper/XMLParser.php index 58acdaf..d8790c5 100644 --- a/src/Helper/XMLParser.php +++ b/src/Helper/XMLParser.php @@ -271,7 +271,7 @@ class XMLParser $this->_xh['value'] = $this->_xh['ac']; } elseif ($name == 'DATETIME.ISO8601') { if (!preg_match('/^[0-9]{8}T[0-9]{2}:[0-9]{2}:[0-9]{2}$/', $this->_xh['ac'])) { - error_log('XML-RPC: invalid value received in DATETIME: ' . $this->_xh['ac']); + error_log('XML-RPC: ' . __METHOD__ . ': invalid value received in DATETIME: ' . $this->_xh['ac']); } $this->_xh['vt'] = Value::$xmlrpcDateTime; $this->_xh['value'] = $this->_xh['ac']; @@ -290,7 +290,7 @@ class XMLParser } else { // log if receiving something strange, even though we set the value to false anyway if ($this->_xh['ac'] != '0' && strcasecmp($this->_xh['ac'], 'false') != 0) { - error_log('XML-RPC: invalid value received in BOOLEAN: ' . $this->_xh['ac']); + error_log('XML-RPC: ' . __METHOD__ . ': invalid value received in BOOLEAN: ' . $this->_xh['ac']); } $this->_xh['value'] = false; } @@ -300,7 +300,7 @@ class XMLParser // NOTE: regexp could be much stricter than this... if (!preg_match('/^[+-eE0123456789 \t.]+$/', $this->_xh['ac'])) { /// @todo: find a better way of throwing an error than this! - error_log('XML-RPC: non numeric value received in DOUBLE: ' . $this->_xh['ac']); + error_log('XML-RPC: ' . __METHOD__ . ': non numeric value received in DOUBLE: ' . $this->_xh['ac']); $this->_xh['value'] = 'ERROR_NON_NUMERIC_FOUND'; } else { // it's ok, add it on @@ -311,7 +311,7 @@ class XMLParser // we must check that only 0123456789- are characters here if (!preg_match('/^[+-]?[0123456789 \t]+$/', $this->_xh['ac'])) { /// @todo find a better way of throwing an error than this! - error_log('XML-RPC: non numeric value received in INT: ' . $this->_xh['ac']); + error_log('XML-RPC: ' . __METHOD__ . ': non numeric value received in INT: ' . $this->_xh['ac']); $this->_xh['value'] = 'ERROR_NON_NUMERIC_FOUND'; } else { // it's ok, add it on @@ -332,7 +332,7 @@ class XMLParser $vscount = count($this->_xh['valuestack']); $this->_xh['valuestack'][$vscount - 1]['values'][$this->_xh['valuestack'][$vscount - 1]['name']] = $this->_xh['value']; } else { - error_log('XML-RPC: missing VALUE inside STRUCT in received xml'); + error_log('XML-RPC: ' . __METHOD__ . ': missing VALUE inside STRUCT in received xml'); } break; case 'DATA': @@ -356,7 +356,7 @@ class XMLParser $this->_xh['params'][] = $this->_xh['value']; $this->_xh['pt'][] = $this->_xh['vt']; } else { - error_log('XML-RPC: missing VALUE inside PARAM in received xml'); + error_log('XML-RPC: ' . __METHOD__ . ': missing VALUE inside PARAM in received xml'); } break; case 'METHODNAME': diff --git a/src/Server.php b/src/Server.php index fdcd620..9f74412 100644 --- a/src/Server.php +++ b/src/Server.php @@ -390,7 +390,6 @@ class Server return $r; } } else { - //error_log('The server sent deflated data. Your php install must have the Zlib extension compiled in to support this.'); $r = new Response(0, PhpXmlRpc::$xmlrpcerr['server_cannot_decompress'], PhpXmlRpc::$xmlrpcstr['server_cannot_decompress']); return $r; -- 2.43.0