You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The $perPage parameter of LengthAwarePaginator/CursorPaginator must be an integer according to docblocks, but when the parameter is an integer in a string, it is never cast to an integer. Such casting is already done on $lastPage and $currentPage, but not yet on $perPage. This PR fixes that.
I don't think we should cast this. If you send in something else than an integer then there's a bug in your app somewhere and I think you should be made aware of that.
When you use the paginate-method with a "per page" value from a querystring parameter, then that value is an integer in a string. This is similar to the default page parameter in the querystring that is used by the paginator. The currentPage value is, because of that, also an integer as a string by default, but it is cast in the constructor of the LenghtAwarePaginator. So I think it is logical to do the same with the perPage value.
This ensures the json-encoded version of the paginator always returns per_page as an integer, because you now may get in the situation that per_page json value is sometimes a string and sometimes an integer
When you provided an actual string as perPage, not an integer in a string, you will still get an exception because the query will fail when using a string as a limit amount
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
$perPageparameter ofLengthAwarePaginator/CursorPaginatormust be an integer according to docblocks, but when the parameter is an integer in a string, it is never cast to an integer. Such casting is already done on$lastPageand$currentPage, but not yet on$perPage. This PR fixes that.