[wp-trac] [WordPress Trac] #37122: Error out when xml_create_parser is not available

WordPress Trac noreply at wordpress.org
Tue Sep 13 18:16:12 UTC 2016


#37122: Error out when xml_create_parser is not available
---------------------------+-----------------------
 Reporter:  kraftbj        |       Owner:  kraftbj
     Type:  defect (bug)   |      Status:  accepted
 Priority:  normal         |   Milestone:  4.7
Component:  XML-RPC        |     Version:
 Severity:  normal         |  Resolution:
 Keywords:  needs-refresh  |     Focuses:
---------------------------+-----------------------
Changes (by GaryJ):

 * keywords:  has-patch commit => needs-refresh


Comment:

 The check before the solitary call to `xml_parser_create_ns()` is a check
 for `xml_parser_create()`. While presumably the former will be available
 when the latter is also available, why not actually check for the function
 that's about to be called?

 For the cases when duplicate code is created (check + call to
 `xml_parser_create()`), I think it may make more sense to add in a
 `wp_xml_parser_create()` that can handle this in a cleaner way. i.e.

 {{{#!php
 function wp_xml_parser_create( $encoding = null ) {
     if ( ! function_exists( 'xml_parser_create' ) ) {
         trigger_error( __( 'The XML extension for PHP is not available.
 Please contact your hosting provider to enable it." ) );
     }

     return xml_parser_create( $encoding );
 }
 }}}

 Then use `wp_xml_parser_create()` in the instances where non-library code
 in WP currently uses `xml_parser_create()`.

 Regardless of my suggestion, I think the patch needs a refresh, as some
 files have been moved around.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/37122#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list