Make WordPress Core

Ticket #56336: 56336.diff

File 56336.diff, 1.0 KB (added by costdev, 3 years ago)

Add type checks to WP_Sitemaps_Registry::get_provider() and taxonomy_exists().

  • src/wp-includes/sitemaps/class-wp-sitemaps-registry.php

    diff --git a/src/wp-includes/sitemaps/class-wp-sitemaps-registry.php b/src/wp-includes/sitemaps/class-wp-sitemaps-registry.php
    index 5cb2e2fa45..6edf1dfe5c 100644
    a b class WP_Sitemaps_Registry { 
    6565         * @return WP_Sitemaps_Provider|null Sitemap provider if it exists, null otherwise.
    6666         */
    6767        public function get_provider( $name ) {
    68                 if ( ! isset( $this->providers[ $name ] ) ) {
     68                if ( ! is_string( $name ) || ! isset( $this->providers[ $name ] ) ) {
    6969                        return null;
    7070                }
    7171
  • src/wp-includes/taxonomy.php

    diff --git a/src/wp-includes/taxonomy.php b/src/wp-includes/taxonomy.php
    index 698a0699cc..f1433b20bc 100644
    a b function get_taxonomy( $taxonomy ) { 
    337337function taxonomy_exists( $taxonomy ) {
    338338        global $wp_taxonomies;
    339339
    340         return isset( $wp_taxonomies[ $taxonomy ] );
     340        return is_string( $taxonomy ) && isset( $wp_taxonomies[ $taxonomy ] );
    341341}
    342342
    343343/**