One more fix for issue #55
[plcapi.git] / src / Request.php
index 0051e46..b3b8112 100644 (file)
@@ -109,7 +109,7 @@ class Request
      */
     public function addParam($param)
     {
-        // add check: do not add to self params which are not xmlrpc values
+        // check: do not add to self params which are not xmlrpc values
         if (is_object($param) && is_a($param, 'PhpXmlRpc\Value')) {
             $this->params[] = $param;
 
@@ -288,7 +288,7 @@ class Request
         xml_set_default_handler($parser, 'xmlrpc_dh');
 
         // first error check: xml not well formed
-        if (!xml_parse($parser, $data, count($data))) {
+        if (!xml_parse($parser, $data, 1)) {
             // thanks to Peter Kocks <peter.kocks@baygate.com>
             if ((xml_get_current_line_number($parser)) == 1) {
                 $errStr = 'XML error at line 1, check URL';
@@ -298,7 +298,7 @@ class Request
                     xml_get_current_line_number($parser), xml_get_current_column_number($parser));
             }
             error_log($errStr);
-            $r = new Response(0, PhpXmlRpc::$xmlrpcerr['invalid_return'], PhpXmlRpc::$xmlrpcstr['invalid_return'] . ' (' . $errStr . ')');
+            $r = new Response(0, PhpXmlRpc::$xmlrpcerr['invalid_return'], PhpXmlRpc::$xmlrpcstr['invalid_return'] . ' ' . $errStr);
             xml_parser_free($parser);
             if ($this->debug) {
                 print $errStr;
@@ -334,8 +334,7 @@ class Request
                 );
             }
 
-            // note that using =& will raise an error if $xmlRpcParser->_xh['st'] does not generate an object.
-            $v = &$xmlRpcParser->_xh['value'];
+            $v = $xmlRpcParser->_xh['value'];
 
             if ($xmlRpcParser->_xh['isf']) {
                 /// @todo we should test here if server sent an int and a string, and/or coerce them into such...
@@ -380,10 +379,10 @@ class Request
     /**
      * Enables/disables the echoing to screen of the xmlrpc responses received.
      *
-     * @param integer $in values 0, 1, 2 are supported
+     * @param integer $level values 0, 1, 2 are supported
      */
-    public function setDebug($in)
+    public function setDebug($level)
     {
-        $this->debug = $in;
+        $this->debug = $level;
     }
 }