Move deprecated methods into the compatibility classes, out of the main library classes
authorgggeek <giunta.gaetano@gmail.com>
Mon, 23 Mar 2015 00:48:50 +0000 (00:48 +0000)
committergggeek <giunta.gaetano@gmail.com>
Mon, 23 Mar 2015 00:48:50 +0000 (00:48 +0000)
lib/xmlrpc.inc
lib/xmlrpcs.inc
src/Request.php
src/Server.php
src/Value.php

index 8f08127..51b175d 100644 (file)
@@ -62,10 +62,75 @@ PhpXmlRpc\PhpXmlRpc::exportGlobals();
 
 class xmlrpcval extends PhpXmlRpc\Value
 {
+    /**
+     * @deprecated
+     * @param xmlrpcval $o
+     * @return string
+     */
+    public function serializeval($o)
+    {
+        // add check? slower, but helps to avoid recursion in serializing broken xmlrpcvals...
+        //if (is_object($o) && (get_class($o) == 'xmlrpcval' || is_subclass_of($o, 'xmlrpcval')))
+        //{
+        $ar = $o->me;
+        reset($ar);
+        list($typ, $val) = each($ar);
+
+        return '<value>' . $this->serializedata($typ, $val) . "</value>\n";
+        //}
+    }
+
+    /**
+     * @deprecated this code looks like it is very fragile and has not been fixed
+     * for a long long time. Shall we remove it for 2.0?
+     */
+    public function getval()
+    {
+        // UNSTABLE
+        reset($this->me);
+        list($a, $b) = each($this->me);
+        // contributed by I Sofer, 2001-03-24
+        // add support for nested arrays to scalarval
+        // i've created a new method here, so as to
+        // preserve back compatibility
+
+        if (is_array($b)) {
+            @reset($b);
+            while (list($id, $cont) = @each($b)) {
+                $b[$id] = $cont->scalarval();
+            }
+        }
+
+        // add support for structures directly encoding php objects
+        if (is_object($b)) {
+            $t = get_object_vars($b);
+            @reset($t);
+            while (list($id, $cont) = @each($t)) {
+                $t[$id] = $cont->scalarval();
+            }
+            @reset($t);
+            while (list($id, $cont) = @each($t)) {
+                @$b->$id = $cont;
+            }
+        }
+        // end contrib
+        return $b;
+    }
+
 }
 
 class xmlrpcmsg extends PhpXmlRpc\Request
 {
+    /**
+     * Kept the old name even if Request class was renamed, for compatibility.
+     * @deprecated
+     *
+     * @return string
+     */
+    public function kindOf()
+    {
+        return 'msg';
+    }
 }
 
 class xmlrpcresp extends PhpXmlRpc\Response
index 7daf1c4..761f3e1 100644 (file)
@@ -46,6 +46,15 @@ include_once(__DIR__.'/../src/Server.php');
 
 class xmlrpc_server extends PhpXmlRpc\Server
 {
+    /**
+     * A debugging routine: just echoes back the input packet as a string value
+     * @deprecated
+     */
+    public function echoInput()
+    {
+        $r = new Response(new PhpXmlRpc\Value("'Aha said I: '" . file_get_contents('php://input'), 'string'));
+        print $r->serialize();
+    }
 }
 
 /* Expose as global functions the ones which are now class methods */
index a136bb3..77567ab 100644 (file)
@@ -43,16 +43,6 @@ class Request
         return '</methodCall>';
     }
 
-    /**
-     * Kept the old name even if class was renamed, for compatibility.
-     *
-     * @return string
-     */
-    private function kindOf()
-    {
-        return 'msg';
-    }
-
     public function createPayload($charset_encoding = '')
     {
         if ($charset_encoding != '') {
@@ -297,7 +287,7 @@ class Request
         }
 
         $data = substr($data, $bd);
-        
+
         if ($this->debug && count($this->httpResponse['headers'])) {
             $msg = '';
             foreach ($this->httpResponse['headers'] as $header => $value) {
index e1035d3..7d345aa 100644 (file)
@@ -699,16 +699,6 @@ class Server
         }
     }
 
-    /**
-     * A debugging routine: just echoes back the input packet as a string value
-     * DEPRECATED!
-     */
-    public function echoInput()
-    {
-        $r = new Response(new Value("'Aha said I: '" . file_get_contents('php://input'), 'string'));
-        print $r->serialize();
-    }
-
     /* Functions that implement system.XXX methods of xmlrpc servers */
 
     public function getSystemDispatchMap()
index e47e954..0f39a67 100644 (file)
@@ -229,7 +229,7 @@ class Value
         }
     }
 
-    private function serializedata($typ, $val, $charset_encoding = '')
+    protected function serializedata($typ, $val, $charset_encoding = '')
     {
         $rs = '';
 
@@ -339,20 +339,6 @@ class Value
         //}
     }
 
-    // DEPRECATED
-    public function serializeval($o)
-    {
-        // add check? slower, but helps to avoid recursion in serializing broken xmlrpcvals...
-        //if (is_object($o) && (get_class($o) == 'xmlrpcval' || is_subclass_of($o, 'xmlrpcval')))
-        //{
-        $ar = $o->me;
-        reset($ar);
-        list($typ, $val) = each($ar);
-
-        return '<value>' . $this->serializedata($typ, $val) . "</value>\n";
-        //}
-    }
-
     /**
      * Checks whether a struct member with a given name is present.
      * Works only on xmlrpcvals of type struct.
@@ -397,41 +383,6 @@ class Value
         return each($this->me['struct']);
     }
 
-    // DEPRECATED! this code looks like it is very fragile and has not been fixed
-    // for a long long time. Shall we remove it for 2.0?
-    public function getval()
-    {
-        // UNSTABLE
-        reset($this->me);
-        list($a, $b) = each($this->me);
-        // contributed by I Sofer, 2001-03-24
-        // add support for nested arrays to scalarval
-        // i've created a new method here, so as to
-        // preserve back compatibility
-
-        if (is_array($b)) {
-            @reset($b);
-            while (list($id, $cont) = @each($b)) {
-                $b[$id] = $cont->scalarval();
-            }
-        }
-
-        // add support for structures directly encoding php objects
-        if (is_object($b)) {
-            $t = get_object_vars($b);
-            @reset($t);
-            while (list($id, $cont) = @each($t)) {
-                $t[$id] = $cont->scalarval();
-            }
-            @reset($t);
-            while (list($id, $cont) = @each($t)) {
-                @$b->$id = $cont;
-            }
-        }
-        // end contrib
-        return $b;
-    }
-
     /**
      * Returns the value of a scalar xmlrpcval.
      *