Cast limit to int in all branches.

This commit is contained in:
Peter Fabian 2022-03-18 10:10:08 +01:00
parent c4b965e543
commit 6e9ed9a83a
2 changed files with 2 additions and 2 deletions

View File

@ -264,7 +264,7 @@ class WC_Payment_Token_Data_Store extends WC_Data_Store_WP implements WC_Payment
}
$page = isset( $args['page'] ) ? absint( $args['page'] ) : 1;
$posts_per_page = isset( $args['limit'] ) ? absint( $args['limit'] ) : get_option( 'posts_per_page' );
$posts_per_page = absint( isset( $args['limit'] ) ? $args['limit'] : get_option( 'posts_per_page' ) );
$pgstrt = absint( ( $page - 1 ) * $posts_per_page ) . ', ';
$limits = 'LIMIT ' . $pgstrt . $posts_per_page;

View File

@ -419,7 +419,7 @@ class WC_API_Taxes extends WC_API_Resource {
$order_by = ' ORDER BY tax_rate_order';
// Pagination
$per_page = isset( $args['posts_per_page'] ) ? $args['posts_per_page'] : get_option( 'posts_per_page' );
$per_page = absint( isset( $args['posts_per_page'] ) ? $args['posts_per_page'] : get_option( 'posts_per_page' ) );
$offset = 1 < $args['paged'] ? ( $args['paged'] - 1 ) * $per_page : 0;
$pagination = sprintf( ' LIMIT %d, %d', $offset, $per_page );