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

Description
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:
$total_terms = wp_count_terms( $this->taxonomy, $prepared_args );
$response->header( 'X-WP-Total', (int) $total_terms );
$max_pages = ceil( $total_terms / $request['per_page'] );
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_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.
$max_pages = ceil( (int) $total_terms / $request['per_page'] );