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

Countable exception in Statamic\Tags\Collection\Entries #2904

Closed
Daynnnnn opened this issue Nov 24, 2020 · 0 comments · Fixed by #2912
Closed

Countable exception in Statamic\Tags\Collection\Entries #2904

Daynnnnn opened this issue Nov 24, 2020 · 0 comments · Fixed by #2912

Comments

@Daynnnnn
Copy link
Contributor

Bug Description

Sometimes when getting collections filtered by taxonomies, we get a countable error.

How to Reproduce

The code which causes the error for us is:
{{ collection:blog_posts as="posts" limit="6" :taxonomy:categories="categories" :slug:not="slug"}}

Extra Detail

I believe this could have been introduced in #2672 as the issue wasn't there until we updated statamic to 3.0.20. To get around the 500 I've used is_countable on line 312 of Statamic\Tags\Collection\Entries to check if what's being passed in is countable before counting it. Although; I'm not sure if that's going to cause other issues, and it would mean the minimum supported PHP version would need to be bumped up to PHP 7.3.

Currently the variable being counted seems to be set to null, which could be related to me using the eloquent driver? I'm not sure. But in the past the variable has been of type Statamic\Taxonomies\LocalizedTerm, which doesn't implement countable hence the error.

Environment

Statamic 3.0.20 Pro
Laravel 7.29.3
PHP 7.4.12
statamic/eloquent-driver 0.1.0
statamic/seo-pro 2.0.14

Install method (choose one):

  • Fresh install from statamic/statamic
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 a pull request may close this issue.

1 participant