WordPress.org

Make WordPress Core

Ticket #37122: 37122.4.diff

File 37122.4.diff, 3.6 KB (added by kraftbj, 3 years ago)

updated patch

  • src/wp-admin/link-parse-opml.php

     
    7272}
    7373
    7474// Create an XML parser
     75if ( ! 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        wp_die( __( "PHP's XML extension is not available. Please contact your hosting provider to enable PHP's XML extension." ) );
     78}
     79
    7580$xml_parser = xml_parser_create();
    7681
    7782// Set the functions to handle opening and closing tags
  • src/wp-includes/IXR/class-IXR-message.php

     
    4444
    4545    function parse()
    4646    {
     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
    4752        // first remove the XML declaration
    4853        // merged from WP #10698 - this method avoids the RAM usage of preg_replace on very large messages
    4954        $header = preg_replace( '/<\?xml.*?\?'.'>/s', '', substr( $this->message, 0, 100 ), 1 );
  • src/wp-includes/atomlib.php

     
    121121
    122122        array_unshift($this->ns_contexts, array());
    123123
     124        if ( ! function_exists( 'xml_parser_create_ns' ) ) {
     125                trigger_error( __( "PHP's XML extension is not available. Please contact your hosting provider to enable PHP's XML extension." ) );
     126                return false;
     127        }
     128
    124129        $parser = xml_parser_create_ns();
    125130        xml_set_object($parser, $this);
    126131        xml_set_element_handler($parser, "start_element", "end_element");
  • src/wp-includes/feed.php

     
    538538                return array('text', $data);
    539539        }
    540540
     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
    541547        $parser = xml_parser_create();
    542548        xml_parse($parser, '<div>' . $data . '</div>', true);
    543549        $code = xml_get_error_code($parser);
  • src/wp-includes/rss.php

     
    6060         */
    6161        function __construct( $source ) {
    6262
    63                 # if PHP xml isn't compiled in, die
     63                # Check if PHP xml isn't compiled
    6464                #
    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( "PHP's XML extension is not available. Please contact your hosting provider to enable PHP's XML extension." );
     67                }
    6768
    68                 $parser = @xml_parser_create();
     69                $parser = xml_parser_create();
    6970
    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");
    72 
    7371                $this->parser = $parser;
    7472
    7573                # pass in parser, and a reference to this object