Make sure all error messages have the method name
authorgggeek <giunta.gaetano@gmail.com>
Sat, 23 May 2015 22:13:56 +0000 (23:13 +0100)
committergggeek <giunta.gaetano@gmail.com>
Sat, 23 May 2015 22:13:56 +0000 (23:13 +0100)
src/Helper/Charset.php
src/Helper/XMLParser.php
src/Server.php

index a4064d8..9000ffb 100644 (file)
@@ -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;
index 58acdaf..d8790c5 100644 (file)
@@ -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-<space> 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':
index fdcd620..9f74412 100644 (file)
@@ -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;