From c2f3cb2b632fa01ed2f3082f1bde23c64bf254e9 Mon Sep 17 00:00:00 2001
From: Dries Buytaert <dries@buytaert.net>
Date: Tue, 29 Apr 2003 22:02:02 +0000
Subject: [PATCH] - Renamed 'xmlrpc_decode' to '_xmlrpc_decode' to avoid
 redeclaration when   PHP's XML-RPC library is enabled.

- Renamed 'xmlrpc_encode' to '_xmlrpc_encode' to avoid redeclaration when
  PHP's XML-RPC library is enabled.

- Removed 'if (funcion_exist("xmlrpc_encode"))' check from common.inc.
---
 includes/common.inc |  5 +----
 includes/xmlrpc.inc | 24 ++++++++++++------------
 2 files changed, 13 insertions(+), 16 deletions(-)

diff --git a/includes/common.inc b/includes/common.inc
index 4f9833b31269..0bed53fde285 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -962,10 +962,7 @@ function page_footer() {
 include_once "includes/theme.inc";
 include_once "includes/pager.inc";
 include_once "includes/menu.inc";
-
-if (!function_exists("xmlrpc_decode")) {
-  include_once "includes/xmlrpc.inc";
-}
+include_once "includes/xmlrpc.inc";
 
 // initialize configuration variables, using values from conf.php if available:
 $conf = variable_init(isset($conf) ? $conf : array());
diff --git a/includes/xmlrpc.inc b/includes/xmlrpc.inc
index d9f53bc38c9b..77b1f7129275 100644
--- a/includes/xmlrpc.inc
+++ b/includes/xmlrpc.inc
@@ -1008,13 +1008,13 @@ function iso8601_decode($idate, $utc=0) {
   return $t;
 }
 
-/****************************************************************
-* xmlrpc_decode takes a message in PHP xmlrpc object format and *
-* tranlates it into native PHP types.                           *
-*                                                               *
-* author: Dan Libby (dan@libby.com)                             *
-****************************************************************/
-function xmlrpc_decode($xmlrpc_val) {
+/*****************************************************************
+* _xmlrpc_decode takes a message in PHP xmlrpc object format and *
+* tranlates it into native PHP types.                            *
+*                                                                *
+* author: Dan Libby (dan@libby.com)                              *
+*****************************************************************/
+function _xmlrpc_decode($xmlrpc_val) {
    $kind = $xmlrpc_val->kindOf();
 
    if($kind == "scalar") {
@@ -1025,7 +1025,7 @@ function xmlrpc_decode($xmlrpc_val) {
       $arr = array();
 
       for($i = 0; $i < $size; $i++) {
-         $arr[]=xmlrpc_decode($xmlrpc_val->arraymem($i));
+         $arr[]=_xmlrpc_decode($xmlrpc_val->arraymem($i));
       }
       return $arr;
    }
@@ -1034,14 +1034,14 @@ function xmlrpc_decode($xmlrpc_val) {
       $arr = array();
 
       while(list($key,$value)=$xmlrpc_val->structeach()) {
-         $arr[$key] = xmlrpc_decode($value);
+         $arr[$key] = _xmlrpc_decode($value);
       }
       return $arr;
    }
 }
 
 /****************************************************************
-* xmlrpc_encode takes native php types and encodes them into    *
+* _xmlrpc_encode takes native php types and encodes them into   *
 * xmlrpc PHP object format.                                     *
 * BUG: All sequential arrays are turned into structs.  I don't  *
 * know of a good way to determine if an array is sequential     *
@@ -1052,7 +1052,7 @@ function xmlrpc_decode($xmlrpc_val) {
 *                                                               *
 * author: Dan Libby (dan@libby.com)                             *
 ****************************************************************/
-function xmlrpc_encode($php_val) {
+function _xmlrpc_encode($php_val) {
    global $xmlrpcInt;
    global $xmlrpcDouble;
    global $xmlrpcString;
@@ -1068,7 +1068,7 @@ function xmlrpc_encode($php_val) {
       case "object":
          $arr = array();
          while (list($k,$v) = each($php_val)) {
-            $arr[$k] = xmlrpc_encode($v);
+            $arr[$k] = _xmlrpc_encode($v);
          }
          $xmlrpc_val->addStruct($arr);
          break;
-- 
GitLab