• in 2.1.8, we sometimes get this error in the Apache error logs when using the search with show all results:

    Undefined array key “totalResults” in /plugins/site-search-360/class-sitesearch360-plugin.php on line 565

    Code looks like this

        try {
            $results = $this->client->search($searchterm, $limit, $log);
        } catch (Error $e) {
            return $posts;
        }
    
        $totalResults = $results['totalResults'];
        if ($totalResults == 0) {
            return array();
        }

    It would be better to

        $totalResults = $results['totalResults'] ?? 0;

    And also other array access by key further down in the code.

    – The error happens out of the blue without us touching anything.
    – Reindexing the articles doesn’t fix it.
    – Disabling the site-search-360 plugin fixes the issue.


You must be logged in to reply to this topic.