diff options
author | Seth Mos <seth.mos@xs4all.nl> | 2007-05-09 17:01:04 +0000 |
---|---|---|
committer | Seth Mos <seth.mos@xs4all.nl> | 2007-05-09 17:01:04 +0000 |
commit | 9c22a703bc7d3fff540c64fe3f0e5e1fd3db0a45 (patch) | |
tree | e30b549106d184efb0cd58f3aea880687e3c56e7 /etc/inc/xmlrpc_server.inc | |
parent | 9534ea8b210f0e4f525f342d8356743208a38cb2 (diff) | |
download | pfsense-9c22a703bc7d3fff540c64fe3f0e5e1fd3db0a45.zip pfsense-9c22a703bc7d3fff540c64fe3f0e5e1fd3db0a45.tar.gz |
Update XML_RPC to 1.5.1
This fixes sync issues on configs > 500KB
Diffstat (limited to 'etc/inc/xmlrpc_server.inc')
-rw-r--r-- | etc/inc/xmlrpc_server.inc | 56 |
1 files changed, 49 insertions, 7 deletions
diff --git a/etc/inc/xmlrpc_server.inc b/etc/inc/xmlrpc_server.inc index 3cdce84..eb667ff 100644 --- a/etc/inc/xmlrpc_server.inc +++ b/etc/inc/xmlrpc_server.inc @@ -31,7 +31,7 @@ * @author Stig Bakken <stig@php.net> * @author Martin Jansen <mj@php.net> * @author Daniel Convissor <danielc@php.net> - * @copyright 1999-2001 Edd Dumbill, 2001-2005 The PHP Group + * @copyright 1999-2001 Edd Dumbill, 2001-2006 The PHP Group * @version CVS: $Id$ * @link http://pear.php.net/package/XML_RPC */ @@ -269,13 +269,22 @@ function XML_RPC_Server_debugmsg($m) * @author Stig Bakken <stig@php.net> * @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.5 + * @copyright 1999-2001 Edd Dumbill, 2001-2006 The PHP Group + * @version Release: 1.5.1 * @link http://pear.php.net/package/XML_RPC */ class XML_RPC_Server { /** + * Should the payload's content be passed through mb_convert_encoding()? + * + * @see XML_RPC_Server::setConvertPayloadEncoding() + * @since Property available since Release 1.5.1 + * @var boolean + */ + var $convert_payload_encoding = false; + + /** * The dispatch map, listing the methods this server provides. * @var array */ @@ -365,7 +374,7 @@ class XML_RPC_Server if ($XML_RPC_Server_debuginfo != '') { return "<!-- PEAR XML_RPC SERVER DEBUG INFO:\n\n" - . preg_replace('/-(?=-)/', '- ', $XML_RPC_Server_debuginfo) + . $GLOBALS['XML_RPC_func_ereg_replace']('--', '- - ', $XML_RPC_Server_debuginfo) . "-->\n"; } else { return ''; @@ -373,6 +382,28 @@ class XML_RPC_Server } /** + * Sets whether the payload's content gets passed through + * mb_convert_encoding() + * + * Returns PEAR_ERROR object if mb_convert_encoding() isn't available. + * + * @param int $in where 1 = on, 0 = off + * + * @return void + * + * @see XML_RPC_Message::getEncoding() + * @since Method available since Release 1.5.1 + */ + function setConvertPayloadEncoding($in) + { + if ($in && !function_exists('mb_convert_encoding')) { + return $this->raiseError('mb_convert_encoding() is not available', + XML_RPC_ERROR_PROGRAMMING); + } + $this->convert_payload_encoding = $in; + } + + /** * Sends the response * * The encoding and content-type are determined by @@ -400,9 +431,9 @@ class XML_RPC_Server * 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); + $this->server_headers = $GLOBALS['XML_RPC_func_ereg_replace']("[\r\n]+[ \t]+", + ' ', trim($this->server_headers)); + $headers = $GLOBALS['XML_RPC_func_split']("[\r\n]+", $this->server_headers); foreach ($headers as $header) { header($header); @@ -414,10 +445,17 @@ class XML_RPC_Server /** * Generates the payload and puts it in the $server_payload property * + * If XML_RPC_Server::setConvertPayloadEncoding() was set to true, + * the payload gets passed through mb_convert_encoding() + * to ensure the payload matches the encoding set in the + * XML declaration. The encoding type can be manually set via + * XML_RPC_Message::setSendEncoding(). + * * @return void * * @uses XML_RPC_Server::parseRequest(), XML_RPC_Server::$encoding, * XML_RPC_Response::serialize(), XML_RPC_Server::serializeDebug() + * @see XML_RPC_Server::setConvertPayloadEncoding() */ function createServerPayload() { @@ -426,6 +464,10 @@ class XML_RPC_Server . $this->encoding . '"?>' . "\n" . $this->serializeDebug() . $r->serialize(); + if ($this->convert_payload_encoding) { + $this->server_payload = mb_convert_encoding($this->server_payload, + $this->encoding); + } } /** |