Make WordPress Core

Ticket #29957: class-IXR.2.diff

File class-IXR.2.diff, 990 bytes (added by ankit.gade@…, 9 years ago)

function_exists() check before applying filter.

  • wp-includes/class-IXR.php

     
    241241        xml_set_object($this->_parser, $this);
    242242        xml_set_element_handler($this->_parser, 'tag_open', 'tag_close');
    243243        xml_set_character_data_handler($this->_parser, 'cdata');
    244         $chunk_size = 262144; // 256Kb, parse in chunks to avoid the RAM usage on very large messages
     244
     245                /**
     246                 * Allows to set maximum memory that can be used to parse xml-rpc reponse message.
     247                 *
     248                 * @param int 262144 Default value of memory allotted.
     249                 */
     250                $chunk_size     =       262144; // 256Kb, parse in chunks to avoid the RAM usage on very large messages
     251                if ( function_exists( 'apply_filters' ) ) {
     252                        $chunk_size = apply_filters( 'xmlrpc_memory_limit', $chunk_size );
     253                }
    245254        $final = false;
    246255        do {
    247256            if (strlen($this->message) <= $chunk_size) {