Skip to content
This repository was archived by the owner on Sep 24, 2018. It is now read-only.

Conversation

@Toddses
Copy link
Contributor

@Toddses Toddses commented Sep 22, 2015

For the /terms/ endpoints, if the parent param is 0 (eg. retrieve all top-level terms), it fails to take into account that no taxonomy with an id of 0 exists.

For the per_page, it tries to figure out the $max_pages by dividing the total items by the per_page parameter. This of course fails because of dividing by 0.

@Toddses Toddses changed the title fixes issue with request params 'parent' and 'per_page' being 0 fixes issue with terms controller request params 'parent' and 'per_page' being 0 Sep 22, 2015
@Toddses
Copy link
Contributor Author

Toddses commented Sep 24, 2015

this may be an issue with the other controllers as well, not just the terms controller.

@rachelbaker
Copy link
Member

@Toddses Hello, and thanks for submitting this PR. per_page should never be 0. I think the best approach to fixing that bug, is setting a default value (see #1603) so we don't divide by zero if the per_page argument isn't set.

rachelbaker added a commit that referenced this pull request Sep 27, 2015
@rachelbaker
Copy link
Member

Merged in #1604

@Toddses
Copy link
Contributor Author

Toddses commented Sep 28, 2015

What about when we want to query for all terms? Passing 0 in the number arg to the get_terms() function is one way. The default for number is to return all terms. However, if the default value is 10 in the terms controller, and we can't pass 0, there's no way to query for all terms.

@Toddses Toddses deleted the terms-controller-fix branch September 28, 2015 14:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants