From 380d27331ea48dce81340dd11210056859b99b07 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Tue, 13 Oct 2015 01:00:04 +0000 Subject: [PATCH] XML-RPC: Add a filter, `xmlrpc_memory_limit`, to allow the value of `$xmlrpc_memory_limit` to be increased. Props ankit.gade. Fixes #29957. git-svn-id: https://develop.svn.wordpress.org/trunk@35095 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/class-IXR.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/class-IXR.php b/src/wp-includes/class-IXR.php index 7cc4c20fb9..9109cbd4d6 100644 --- a/src/wp-includes/class-IXR.php +++ b/src/wp-includes/class-IXR.php @@ -268,7 +268,18 @@ class IXR_Message xml_set_object($this->_parser, $this); xml_set_element_handler($this->_parser, 'tag_open', 'tag_close'); xml_set_character_data_handler($this->_parser, 'cdata'); - $chunk_size = 262144; // 256Kb, parse in chunks to avoid the RAM usage on very large messages + + // 256Kb, parse in chunks to avoid the RAM usage on very large messages + $xmlrpc_memory_limit = 262144; + /** + * Filter the maximum memory that can be used to parse an XML-RPC reponse message. + * + * @since 4.4.0 + * + * @param int $xmlrpc_memory_limit Default value of memory allotted. + */ + $chunk_size = apply_filters( 'xmlrpc_memory_limit', $xmlrpc_memory_limit ); + $final = false; do { if (strlen($this->message) <= $chunk_size) {