Make WordPress Core


Ignore:
Timestamp:
11/26/2024 09:15:31 PM (23 months ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Cast wp_count_terms() result to int before using in ceil().

This addresses two instances of the (numeric string) return value from wp_count_terms() being used directly in ceil(), which expects an int|float.

Affected methods:

  • WP_Sitemaps_Taxonomies::get_max_num_pages()
  • wp_nav_menu_item_taxonomy_meta_box()

Reference: ​PHP Manual: ceil().

Follow-up to [14248], [14291], [14569], [14943], [48072], [57648].

Props justlevine.
See #52217.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/sitemaps/providers/class-wp-sitemaps-taxonomies.php

    r56586 r59462  
    172172                $term_count = wp_count_terms( $this->get_taxonomies_query_args( $taxonomy ) );
    173173
    174                 return (int) ceil( $term_count / wp_sitemaps_get_max_urls( $this->object_type ) );
     174                return (int) ceil( (int) $term_count / wp_sitemaps_get_max_urls( $this->object_type ) );
    175175        }
    176176
Note: See TracChangeset for help on using the changeset viewer.