From 6e9ed9a83a65c179b3d634c4d085758acf842e8b Mon Sep 17 00:00:00 2001 From: Peter Fabian Date: Fri, 18 Mar 2022 10:10:08 +0100 Subject: [PATCH] Cast limit to int in all branches. --- .../includes/data-stores/class-wc-payment-token-data-store.php | 2 +- .../woocommerce/includes/legacy/api/v3/class-wc-api-taxes.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/woocommerce/includes/data-stores/class-wc-payment-token-data-store.php b/plugins/woocommerce/includes/data-stores/class-wc-payment-token-data-store.php index f7ebc18593f..11e510a8724 100644 --- a/plugins/woocommerce/includes/data-stores/class-wc-payment-token-data-store.php +++ b/plugins/woocommerce/includes/data-stores/class-wc-payment-token-data-store.php @@ -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; diff --git a/plugins/woocommerce/includes/legacy/api/v3/class-wc-api-taxes.php b/plugins/woocommerce/includes/legacy/api/v3/class-wc-api-taxes.php index 887a793a1dc..d5a96ccf994 100644 --- a/plugins/woocommerce/includes/legacy/api/v3/class-wc-api-taxes.php +++ b/plugins/woocommerce/includes/legacy/api/v3/class-wc-api-taxes.php @@ -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 );