MDL-61281 search_solr: PHP 7.2 compatible counts
authorDavid Monllao <davidm@moodle.com>
Fri, 26 Jan 2018 12:11:51 +0000 (13:11 +0100)
committerDavid Monllao <davidm@moodle.com>
Fri, 26 Jan 2018 12:11:51 +0000 (13:11 +0100)
search/engine/solr/classes/engine.php

index 8ca37e2..875f3d1 100644 (file)
@@ -243,7 +243,9 @@ class engine extends \core_search\engine {
         } else if (isset($response->response->numFound)) {
             // Get the number of results for standard queries.
             $found = $response->response->numFound;
-            $included = count($response->response->docs);
+            if ($found > 0 && is_array($response->response->docs)) {
+                $included = count($response->response->docs);
+            }
         }
 
         return array($included, $found);