Make WordPress Core


Ignore:
Timestamp:
02/17/2024 03:22:37 PM (3 years ago)
Author:
swissspidy
Message:

General: Consistently cast return value to int in functions that use ceil().

The return value of ceil() is still of type float as the value range of float is usually bigger than that of int.

Props crstauf, audrasjb.
Fixes #58683.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php

    r57603 r57648  
    404404                }
    405405
    406                 $max_pages = ceil( $total_posts / (int) $posts_query->query_vars['posts_per_page'] );
     406                $max_pages = (int) ceil( $total_posts / (int) $posts_query->query_vars['posts_per_page'] );
    407407
    408408                if ( $page > $max_pages && $total_posts > 0 ) {
Note: See TracChangeset for help on using the changeset viewer.