Skip to content

Commit 520e61d

Browse files
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
1 parent c344148 commit 520e61d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/wp-admin/includes/nav-menu.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -875,7 +875,7 @@ function wp_nav_menu_item_taxonomy_meta_box( $data_object, $box ) {
875875
}
876876

877877
$num_pages = (int) ceil(
878-
wp_count_terms(
878+
(int) wp_count_terms(
879879
array_merge(
880880
$args,
881881
array(

src/wp-includes/sitemaps/providers/class-wp-sitemaps-taxonomies.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ public function get_max_num_pages( $object_subtype = '' ) {
171171

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

177177
/**

0 commit comments

Comments
 (0)