From 9279062a19bef980b1f034716c5dc483eccb3cf5 Mon Sep 17 00:00:00 2001 From: paulburdick Date: Tue, 22 Jan 2008 23:33:33 +0000 Subject: Fixed a bug in the XML-RPC library so that if not type is specified, a more intelligent decision is made as to the default type Also fixed a few formatting problems and updated the eregi() to preg_match() and strncmp(). --- system/libraries/Xmlrpc.php | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'system/libraries') diff --git a/system/libraries/Xmlrpc.php b/system/libraries/Xmlrpc.php index 9eb329346..91e3809a8 100644 --- a/system/libraries/Xmlrpc.php +++ b/system/libraries/Xmlrpc.php @@ -231,7 +231,14 @@ class CI_Xmlrpc { { if ( ! isset($value['1']) OR ! isset($this->xmlrpcTypes[strtolower($value['1'])])) { - $temp = new XML_RPC_Values($value['0'], 'string'); + if (is_array($value[0])) + { + $temp = new XML_RPC_Values($value['0'], 'array'); + } + else + { + $temp = new XML_RPC_Values($value['0'], 'string'); + } } elseif(is_array($value['0']) && ($value['1'] == 'struct' OR $value['1'] == 'array')) { @@ -337,7 +344,7 @@ class CI_Xmlrpc { * XML-RPC Client class * * @category XML-RPC - * @author ExpressionEngine Dev Team + * @author ExpressionEngine Dev Team * @link http://codeigniter.com/user_guide/libraries/xmlrpc.html */ class XML_RPC_Client extends CI_Xmlrpc @@ -492,7 +499,7 @@ class XML_RPC_Response function decode($array=FALSE) { - $CI =& get_instance(); + $CI =& get_instance(); if ($array !== FALSE && is_array($array)) { @@ -577,7 +584,7 @@ class XML_RPC_Response { // return a timet in the localtime, or UTC $t = 0; - if (ereg("([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})", $time, $regs)) + if (preg_match('/([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})/', $time, $regs)) { if ($utc == 1) $t = gmmktime($regs[4], $regs[5], $regs[6], $regs[2], $regs[3], $regs[1]); @@ -680,7 +687,7 @@ class XML_RPC_Message extends CI_Xmlrpc // Check for HTTP 200 Response //------------------------------------- - if(ereg("^HTTP",$data) && !ereg("^HTTP/[0-9\.]+ 200 ", $data)) + if (strncmp($data, 'HTTP', 4) == 0 && ! preg_match('/^HTTP\/[0-9\.]+ 200 /', $data)) { $errstr= substr($data, 0, strpos($data, "\n")-1); $r = new XML_RPC_Response(0, $this->xmlrpcerr['http_error'], $this->xmlrpcstr['http_error']. ' (' . $errstr . ')'); @@ -996,7 +1003,7 @@ class XML_RPC_Message extends CI_Xmlrpc { // we have a DOUBLE // we must check that only 0123456789-. are characters here - if (!ereg("^[+-]?[eE0123456789 \\t\\.]+$", $this->xh[$the_parser]['ac'])) + if (! preg_match('/^[+-]?[eE0-9\t \.]+$/', $this->xh[$the_parser]['ac'])) { $this->xh[$the_parser]['value'] = 'ERROR_NON_NUMERIC_FOUND'; } @@ -1009,7 +1016,7 @@ class XML_RPC_Message extends CI_Xmlrpc { // we have an I4/INT // we must check that only 0123456789- are characters here - if (!ereg("^[+-]?[0123456789 \\t]+$", $this->xh[$the_parser]['ac'])) + if (! preg_match('/^[+-]?[0-9\t ]+$/', $this->xh[$the_parser]['ac'])) { $this->xh[$the_parser]['value'] = 'ERROR_NON_NUMERIC_FOUND'; } @@ -1062,7 +1069,7 @@ class XML_RPC_Message extends CI_Xmlrpc } break; case 'METHODNAME': - $this->xh[$the_parser]['method'] = ereg_replace("^[\n\r\t ]+", '', $this->xh[$the_parser]['ac']); + $this->xh[$the_parser]['method'] = ltrim($this->xh[$the_parser]['ac']); break; case 'PARAMS': case 'FAULT': @@ -1367,7 +1374,6 @@ class XML_RPC_Values extends CI_Xmlrpc function serializeval($o) { - $ar = $o->me; reset($ar); -- cgit v1.2.3-24-g4f1b