summaryrefslogtreecommitdiffstats
path: root/system/libraries/Xmlrpc.php
diff options
context:
space:
mode:
authorpaulburdick <devnull@localhost>2008-01-23 00:33:33 +0100
committerpaulburdick <devnull@localhost>2008-01-23 00:33:33 +0100
commit9279062a19bef980b1f034716c5dc483eccb3cf5 (patch)
tree2a2094f1b0feba585810eae885ba0732f0800a49 /system/libraries/Xmlrpc.php
parent2e061440560701f68dd2d65d8d56355f4bdfe6f4 (diff)
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().
Diffstat (limited to 'system/libraries/Xmlrpc.php')
-rw-r--r--system/libraries/Xmlrpc.php24
1 files changed, 15 insertions, 9 deletions
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-.<space> 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-<space> 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);