Ticket #37122: 37122.2.diff
| File 37122.2.diff, 4.5 KB (added by , 10 years ago) |
|---|
-
src/wp-admin/link-parse-opml.php
72 72 } 73 73 74 74 // Create an XML parser 75 $xml_parser = xml_parser_create(); 75 if ( ! function_exists( 'xml_parser_create' ) ) { 76 trigger_error( __( "PHP's XML extension is not available. Please contact your hosting provider to enable PHP's XML extension." ) ); 77 } 78 else { 79 $xml_parser = xml_parser_create(); 76 80 77 // Set the functions to handle opening and closing tags78 xml_set_element_handler($xml_parser, "startElement", "endElement");81 // Set the functions to handle opening and closing tags 82 xml_set_element_handler($xml_parser, "startElement", "endElement"); 79 83 80 if ( ! xml_parse( $xml_parser, $opml, true ) ) {81 printf(82 /* translators: 1: error message, 2: line number */83 __( 'XML Error: %1$s at line %2$s' ),84 xml_error_string( xml_get_error_code( $xml_parser ) ),85 xml_get_current_line_number( $xml_parser )86 );87 }84 if ( ! xml_parse( $xml_parser, $opml, true ) ) { 85 printf( 86 /* translators: 1: error message, 2: line number */ 87 __( 'XML Error: %1$s at line %2$s' ), 88 xml_error_string( xml_get_error_code( $xml_parser ) ), 89 xml_get_current_line_number( $xml_parser ) 90 ); 91 } 88 92 89 // Free up memory used by the XML parser 90 xml_parser_free($xml_parser); 93 // Free up memory used by the XML parser 94 xml_parser_free($xml_parser); 95 } -
src/wp-includes/IXR/class-IXR-message.php
44 44 45 45 function parse() 46 46 { 47 if ( ! function_exists( 'xml_parser_create' ) ) { 48 trigger_error( __( "PHP's XML extension is not available. Please contact your hosting provider to enable PHP's XML" ) ); 49 return false; 50 } 51 47 52 // first remove the XML declaration 48 53 // merged from WP #10698 - this method avoids the RAM usage of preg_replace on very large messages 49 54 $header = preg_replace( '/<\?xml.*?\?'.'>/s', '', substr( $this->message, 0, 100 ), 1 ); -
src/wp-includes/atomlib.php
121 121 122 122 array_unshift($this->ns_contexts, array()); 123 123 124 if ( ! function_exists( 'xml_parser_create' ) ) { 125 trigger_error( __( "PHP's XML extension is not available. Please contact your hosting provider to enable PHP's XML extension." ) ); 126 127 return false; 128 } 129 124 130 $parser = xml_parser_create_ns(); 125 131 xml_set_object($parser, $this); 126 132 xml_set_element_handler($parser, "start_element", "end_element"); -
src/wp-includes/feed.php
538 538 return array('text', $data); 539 539 } 540 540 541 if ( ! function_exists( 'xml_parser_create' ) ) { 542 trigger_error( __( "PHP's XML extension is not available. Please contact your hosting provider to enable PHP's XML extension." ) ); 543 544 return array('html', "<![CDATA[$data]]>"); 545 } 546 541 547 $parser = xml_parser_create(); 542 548 xml_parse($parser, '<div>' . $data . '</div>', true); 543 549 $code = xml_get_error_code($parser); -
src/wp-includes/rss.php
60 60 */ 61 61 function __construct( $source ) { 62 62 63 # if PHP xml isn't compiled in, die63 # Check if PHP xml isn't compiled 64 64 # 65 if ( !function_exists('xml_parser_create') ) 66 trigger_error( "Failed to load PHP's XML Extension. https://secure.php.net/manual/en/ref.xml.php" ); 65 if ( ! function_exists('xml_parser_create') ) { 66 return trigger_error( "Failed to load PHP's XML Extension. https://secure.php.net/manual/en/ref.xml.php" ); 67 } 67 68 68 69 $parser = @xml_parser_create(); 69 70 70 if ( !is_resource($parser) ) 71 trigger_error( "Failed to create an instance of PHP's XML parser. https://secure.php.net/manual/en/ref.xml.php"); 71 if ( ! is_resource($parser) ) { 72 return trigger_error( "Failed to create an instance of PHP's XML parser. https://secure.php.net/manual/en/ref.xml.php"); 73 } 72 74 73 75 $this->parser = $parser; 74 76