From 520e61dd75356edd1cba85f263767ad4a581e22d Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 26 Nov 2024 21:15:31 +0000 Subject: [PATCH] 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: [https://www.php.net/manual/en/function.ceil.php PHP Manual: ceil()]. Follow-up to [14248], [14291], [14569], [14943], [48072], [57648]. Props justlevine. See #52217. git-svn-id: https://develop.svn.wordpress.org/trunk@59462 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/nav-menu.php | 2 +- .../sitemaps/providers/class-wp-sitemaps-taxonomies.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wp-admin/includes/nav-menu.php b/src/wp-admin/includes/nav-menu.php index 5ba3276b3aea5..c3b1244f47fd9 100644 --- a/src/wp-admin/includes/nav-menu.php +++ b/src/wp-admin/includes/nav-menu.php @@ -875,7 +875,7 @@ function wp_nav_menu_item_taxonomy_meta_box( $data_object, $box ) { } $num_pages = (int) ceil( - wp_count_terms( + (int) wp_count_terms( array_merge( $args, array( diff --git a/src/wp-includes/sitemaps/providers/class-wp-sitemaps-taxonomies.php b/src/wp-includes/sitemaps/providers/class-wp-sitemaps-taxonomies.php index 5571ff4ed95f3..0c53e95a42d6c 100644 --- a/src/wp-includes/sitemaps/providers/class-wp-sitemaps-taxonomies.php +++ b/src/wp-includes/sitemaps/providers/class-wp-sitemaps-taxonomies.php @@ -171,7 +171,7 @@ public function get_max_num_pages( $object_subtype = '' ) { $term_count = wp_count_terms( $this->get_taxonomies_query_args( $taxonomy ) ); - return (int) ceil( $term_count / wp_sitemaps_get_max_urls( $this->object_type ) ); + return (int) ceil( (int) $term_count / wp_sitemaps_get_max_urls( $this->object_type ) ); } /**