From 869f9b1df5bade6c3d061c21ae64b2704f498495 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 26 Nov 2024 21:17:25 +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. Built from https://develop.svn.wordpress.org/trunk@59462 git-svn-id: http://core.svn.wordpress.org/trunk@58848 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/nav-menu.php | 2 +- wp-includes/sitemaps/providers/class-wp-sitemaps-taxonomies.php | 2 +- wp-includes/version.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/wp-admin/includes/nav-menu.php b/wp-admin/includes/nav-menu.php index 5ba3276b3a..c3b1244f47 100644 --- a/wp-admin/includes/nav-menu.php +++ b/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/wp-includes/sitemaps/providers/class-wp-sitemaps-taxonomies.php b/wp-includes/sitemaps/providers/class-wp-sitemaps-taxonomies.php index 5571ff4ed9..0c53e95a42 100644 --- a/wp-includes/sitemaps/providers/class-wp-sitemaps-taxonomies.php +++ b/wp-includes/sitemaps/providers/class-wp-sitemaps-taxonomies.php @@ -171,7 +171,7 @@ class WP_Sitemaps_Taxonomies extends WP_Sitemaps_Provider { $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 ) ); } /** diff --git a/wp-includes/version.php b/wp-includes/version.php index c2c56b1b4a..16505dc390 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.8-alpha-59461'; +$wp_version = '6.8-alpha-59462'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.