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
{{ message }}
This repository was archived by the owner on Sep 24, 2018. It is now read-only.
Repository navigation
This repository was archived by the owner on Sep 24, 2018. It is now read-only.
Searching terms by parent produces error if none found #1613
When querying terms with the parent parameter set, I'm getting a fatal PHP error (Unsupported operand types) for cases in which it should be an empty array of no results. The line in question is third line here:
Since max_pages is set to the result of wp_count_terms, it can sometimes be an empty array instead of an integer, which then causes the division operation to fail. I've found that an explicit cast to int corrects the error.
When querying terms with the
parentparameter set, I'm getting a fatal PHP error (Unsupported operand types) for cases in which it should be an empty array of no results. The line in question is third line here:In class-wp-rest-terms-controller.php:
https://github.com/WP-API/WP-API/blob/develop/lib/endpoints/class-wp-rest-terms-controller.php#L105
Since
max_pagesis set to the result ofwp_count_terms, it can sometimes be an empty array instead of an integer, which then causes the division operation to fail. I've found that an explicit cast to int corrects the error.