ext-solr icon indicating copy to clipboard operation
ext-solr copied to clipboard

Log flodding "default object from empty value"

Open Mabahe opened this issue 7 years ago • 1 comments

I noticed flodding of sys log with Core: Error handler (FE): PHP Warning: Creating default object from empty value in ... SearchResultSetService.php line 206

Version 8.x here, but I think it is also valid for v9 and master

Related code:

 if ((int)$searchRequest->getResultsPerPage() === 0) {
      // when resultPerPage was forced to 0 we also set the numFound to 0 to hide results, e.g.
      // when results for the initial search should not be shown.
      $response->response->numFound = 0;
 }

$response->response could be empty here, e.g. if the response is a grouped response.

But I noticed that the parsing of the response (where response->response is set from the raw json body) is done after this code. Also numFound is in response->_parsedData->response->numFound now. So the additional question is: is this code still valid and needed here?

Perhaps we should split this tasks. Fix the flodding as first step.

Mabahe avatar Feb 22 '19 11:02 Mabahe

If i open the search results page and there are no results (query was not initialized, there was nothing in the search field), I will end up with:

Attempt to assign property "numFound" on null

in /var/www/html/vendor/apache-solr-for-typo3/solr/Classes/Domain/Search/ResultSet/SearchResultSetService.php line 137

And yes, it happens when grouping is enabled.

UPDATE: in my case I had plugin.tx_solr.search.initializeWithEmptyQuery = 1 and disabling it helped here to avoid this error.

soee avatar Oct 24 '24 07:10 soee