Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.x] Fix cannot use paginate/limit error when one is null #11478

Merged
merged 1 commit into from
Feb 21, 2025

Conversation

jacksleight
Copy link
Contributor

@jacksleight jacksleight commented Feb 20, 2025

#10415 introduced a check to ensure that paginate and limit aren't used at the same time. However due to the has check a null limit value will pass as true even though it wouldn't be applied.

This becomes a problem when trying to pass variables through to tags where limit or paginate might be used:

{{ collection:articles :paginate="paginate" :limit="limit" }}
Statamic::tag('collection:articles', [
	'paginate' => $paginate,
	'limit' => $limit,
]);

I know you could filter the array or maybe use void in antlers, but it would be nice if you didn't have to worry about it. In this example there are conditions further up that ensure only one of those variables would be set.

The PR changes the check to use int so that a null value wont pass as true. The limit param check in the results method also uses int.

@jacksleight jacksleight changed the title Fix cannot use paginate/limit error when one is null [5.x] Fix cannot use paginate/limit error when one is null Feb 20, 2025
@jasonvarga jasonvarga merged commit afd32e8 into statamic:5.x Feb 21, 2025
21 of 22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants