This repository has been archived by the owner on Jan 10, 2018. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle case where no results are returned
When 0 results are returned, Forage returns a string "no results" instead of a properly formatted JSON string. So json_decode() returns null, and that gets passed to SearchResult. SearchResult only accepts an array as input, and throws an E_RECOVERABLE_ERROR. Http Transport now intercepts this case, and outputs a properly formatted array containing no hits or facets, and set totalHits to 0. PHP error: Catchable fatal error: Argument 1 passed to vierbergenlars\Forage\SearchResult\SearchResult::__construct() must be an array, null given, called in /var/www/bay/vendor/vierbergenlars/forage-client/lib/vierbergenlars/Forage/SearchQuery/Query.php on line 174 and defined in /var/www/bay/vendor/vierbergenlars/forage-client/lib/vierbergenlars/Forage/SearchResult/SearchResult.php on line 42 XDebug Trace: 8 0.1450 21947952 vierbergenlars\Forage\ODM\SearchQuery->execute( ) ../SearchController.php:43 9 0.1451 21947952 vierbergenlars\Forage\SearchQuery\Query->execute( ) ../SearchQuery.php:44 10 0.1490 21999232 vierbergenlars\Forage\SearchResult\SearchResult->__construct( $result_array = NULL ) ../Query.php:174
- Loading branch information