Make WordPress Core


Ignore:
Timestamp:
02/17/2024 03:22:37 PM (9 months 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-revisions-controller.php

    r57230 r57648  
    309309
    310310            if ( $revisions_query->query_vars['posts_per_page'] > 0 ) {
    311                 $max_pages = ceil( $total_revisions / (int) $revisions_query->query_vars['posts_per_page'] );
     311                $max_pages = (int) ceil( $total_revisions / (int) $revisions_query->query_vars['posts_per_page'] );
    312312            } else {
    313313                $max_pages = $total_revisions > 0 ? 1 : 0;
Note: See TracChangeset for help on using the changeset viewer.