Changes from branches/3.9/src/wp-includes/class-IXR.php at r29405 to trunk/src/wp-includes/class-IXR.php at r27552
- File:
-
- 1 edited
-
trunk/src/wp-includes/class-IXR.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-IXR.php
r29405 r27552 204 204 // first remove the XML declaration 205 205 // merged from WP #10698 - this method avoids the RAM usage of preg_replace on very large messages 206 $header = preg_replace( '/<\?xml.*?\?'.'>/ s', '', substr( $this->message, 0, 100 ), 1);207 $this->message = trim( substr_replace( $this->message, $header, 0, 100 ));208 if ( '' == $this->message) {206 $header = preg_replace( '/<\?xml.*?\?'.'>/', '', substr($this->message, 0, 100), 1); 207 $this->message = substr_replace($this->message, $header, 0, 100); 208 if (trim($this->message) == '') { 209 209 return false; 210 210 } 211 212 // Then remove the DOCTYPE213 $header = preg_replace( '/^<!DOCTYPE[^>]*+>/i', '', substr( $this->message, 0, 200 ), 1 );214 $this->message = trim( substr_replace( $this->message, $header, 0, 200 ) );215 if ( '' == $this->message ) {216 return false;217 }218 219 // Check that the root tag is valid220 $root_tag = substr( $this->message, 0, strcspn( substr( $this->message, 0, 20 ), "> \t\r\n" ) );221 if ( '<!DOCTYPE' === strtoupper( $root_tag ) ) {222 return false;223 }224 if ( ! in_array( $root_tag, array( '<methodCall', '<methodResponse', '<fault' ) ) ) {225 return false;226 }227 228 // Bail if there are too many elements to parse229 $element_limit = 30000;230 if ( function_exists( 'apply_filters' ) ) {231 $element_limit = apply_filters( 'xmlrpc_element_limit', $element_limit );232 }233 if ( $element_limit && 2 * $element_limit < substr_count( $this->message, '<' ) ) {234 return false;235 }236 237 211 $this->_parser = xml_parser_create(); 238 212 // Set XML parser to take the case of tags in to account
Note: See TracChangeset
for help on using the changeset viewer.