Skip to content
This repository was archived by the owner on Feb 23, 2024. It is now read-only.

Commit 1d477af

Browse files
Aljullunerrad
authored andcommitted
Use absint for per-page param validation (#2563)
* Revert "Fix Products by Category JSON response error (#2551)" This reverts commit 4ba1bbd. * Fix Products by Category JSON response error
1 parent dadbe48 commit 1d477af

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

src/StoreApi/Routes/AbstractTermsRoute.php

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function get_collection_params() {
4141
'type' => 'integer',
4242
'minimum' => 0,
4343
'maximum' => 100,
44-
'sanitize_callback' => [ $this, 'get_intval' ],
44+
'sanitize_callback' => 'absint',
4545
'validate_callback' => 'rest_validate_request_arg',
4646
);
4747

@@ -156,14 +156,4 @@ protected function get_term_count( $taxonomy, $args ) {
156156
unset( $count_args['number'], $count_args['offset'] );
157157
return (int) wp_count_terms( $taxonomy, $count_args );
158158
}
159-
160-
/**
161-
* Wrapper of the `intval` function that only accepts one parameter.
162-
*
163-
* @param mixed $value Value to convert to an int.
164-
* @return int
165-
*/
166-
public function get_intval( $value ) {
167-
return intval( $value );
168-
}
169159
}

0 commit comments

Comments
 (0)