diff options
-rw-r--r-- | etc/inc/xmlrpc_client.inc | 35 | ||||
-rw-r--r-- | etc/inc/xmlrpc_server.inc | 22 |
2 files changed, 38 insertions, 19 deletions
diff --git a/etc/inc/xmlrpc_client.inc b/etc/inc/xmlrpc_client.inc index 6b58b1f..aa329b9 100644 --- a/etc/inc/xmlrpc_client.inc +++ b/etc/inc/xmlrpc_client.inc @@ -446,13 +446,13 @@ function XML_RPC_ee($parser_resource, $name) break; case 'VALUE': - // deal with a string value - if (strlen($XML_RPC_xh[$parser]['ac']) > 0 && - $XML_RPC_xh[$parser]['vt'] == $XML_RPC_String) { - $XML_RPC_xh[$parser]['value'] = $XML_RPC_xh[$parser]['ac']; - } elseif ($XML_RPC_xh[$parser]['lv'] == 1) { - // The <value> element was empty. - $XML_RPC_xh[$parser]['value'] = ''; + if ($XML_RPC_xh[$parser]['vt'] == $XML_RPC_String) { + if (strlen($XML_RPC_xh[$parser]['ac']) > 0) { + $XML_RPC_xh[$parser]['value'] = $XML_RPC_xh[$parser]['ac']; + } elseif ($XML_RPC_xh[$parser]['lv'] == 1) { + // The <value> element was empty. + $XML_RPC_xh[$parser]['value'] = ''; + } } $temp = new XML_RPC_Value($XML_RPC_xh[$parser]['value'], $XML_RPC_xh[$parser]['vt']); @@ -546,7 +546,7 @@ function XML_RPC_cd($parser_resource, $data) * @author Martin Jansen <mj@php.net> * @author Daniel Convissor <danielc@php.net> * @copyright 1999-2001 Edd Dumbill, 2001-2005 The PHP Group - * @version Release: 1.4.2 + * @version Release: 1.4.5 * @link http://pear.php.net/package/XML_RPC */ class XML_RPC_Base { @@ -591,7 +591,7 @@ class XML_RPC_Base { * @author Martin Jansen <mj@php.net> * @author Daniel Convissor <danielc@php.net> * @copyright 1999-2001 Edd Dumbill, 2001-2005 The PHP Group - * @version Release: 1.4.2 + * @version Release: 1.4.5 * @link http://pear.php.net/package/XML_RPC */ class XML_RPC_Client extends XML_RPC_Base { @@ -1014,7 +1014,7 @@ class XML_RPC_Client extends XML_RPC_Base { * @author Martin Jansen <mj@php.net> * @author Daniel Convissor <danielc@php.net> * @copyright 1999-2001 Edd Dumbill, 2001-2005 The PHP Group - * @version Release: 1.4.2 + * @version Release: 1.4.5 * @link http://pear.php.net/package/XML_RPC */ class XML_RPC_Response extends XML_RPC_Base @@ -1105,7 +1105,7 @@ class XML_RPC_Response extends XML_RPC_Base * @author Martin Jansen <mj@php.net> * @author Daniel Convissor <danielc@php.net> * @copyright 1999-2001 Edd Dumbill, 2001-2005 The PHP Group - * @version Release: 1.4.2 + * @version Release: 1.4.5 * @link http://pear.php.net/package/XML_RPC */ class XML_RPC_Message extends XML_RPC_Base @@ -1451,7 +1451,7 @@ class XML_RPC_Message extends XML_RPC_Base * @author Martin Jansen <mj@php.net> * @author Daniel Convissor <danielc@php.net> * @copyright 1999-2001 Edd Dumbill, 2001-2005 The PHP Group - * @version Release: 1.4.2 + * @version Release: 1.4.5 * @link http://pear.php.net/package/XML_RPC */ class XML_RPC_Value extends XML_RPC_Base @@ -1835,7 +1835,6 @@ function XML_RPC_iso8601_encode($timet, $utc = 0) function XML_RPC_iso8601_decode($idate, $utc = 0) { $t = 0; - $regs = ""; if (ereg('([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})', $idate, $regs)) { if ($utc) { $t = gmmktime($regs[4], $regs[5], $regs[6], $regs[2], $regs[3], $regs[1]); @@ -1888,7 +1887,7 @@ function XML_RPC_decode($XML_RPC_val) function XML_RPC_encode($php_val) { global $XML_RPC_Boolean, $XML_RPC_Int, $XML_RPC_Double, $XML_RPC_String, - $XML_RPC_Array, $XML_RPC_Struct; + $XML_RPC_Array, $XML_RPC_Struct, $XML_RPC_DateTime; $type = gettype($php_val); $XML_RPC_val = new XML_RPC_Value; @@ -1928,7 +1927,11 @@ function XML_RPC_encode($php_val) case 'string': case 'NULL': - $XML_RPC_val->addScalar($php_val, $XML_RPC_String); + if(ereg('^[0-9]{8}\T{1}[0-9]{2}\:[0-9]{2}\:[0-9]{2}$', $php_val)) { + $XML_RPC_val->addScalar($php_val, $XML_RPC_DateTime); + } else { + $XML_RPC_val->addScalar($php_val, $XML_RPC_String); + } break; case 'boolean': @@ -1953,4 +1956,4 @@ function XML_RPC_encode($php_val) * End: */ -?>
\ No newline at end of file +?> diff --git a/etc/inc/xmlrpc_server.inc b/etc/inc/xmlrpc_server.inc index cefa15b..3cdce84 100644 --- a/etc/inc/xmlrpc_server.inc +++ b/etc/inc/xmlrpc_server.inc @@ -270,7 +270,7 @@ function XML_RPC_Server_debugmsg($m) * @author Martin Jansen <mj@php.net> * @author Daniel Convissor <danielc@php.net> * @copyright 1999-2001 Edd Dumbill, 2001-2005 The PHP Group - * @version Release: 1.4.2 + * @version Release: 1.4.5 * @link http://pear.php.net/package/XML_RPC */ class XML_RPC_Server @@ -391,7 +391,23 @@ class XML_RPC_Server if (!$this->server_headers) { $this->createServerHeaders(); } - header($this->server_headers); + + /* + * $server_headers needs to remain a string for compatibility with + * old scripts using this package, but PHP 4.4.2 no longer allows + * line breaks in header() calls. So, we split each header into + * an individual call. The initial replace handles the off chance + * that someone composed a single header with multiple lines, which + * the RFCs allow. + */ + $this->server_headers = preg_replace("/[\r\n]+[ \t]+/", ' ', + trim($this->server_headers)); + $headers = preg_split("/[\r\n]+/", $this->server_headers); + foreach ($headers as $header) + { + header($header); + } + print $this->server_payload; } @@ -624,4 +640,4 @@ class XML_RPC_Server * End: */ -?>
\ No newline at end of file +?> |