TYPO3-Solr / ext-solr

A TYPO3 extension that integrates the Apache Solr search server with TYPO3 CMS. dkd Internet Service GmbH is developing the extension. Community contributions are welcome. See CONTRIBUTING.md for details.
GNU General Public License v3.0
136 stars 246 forks source link

Internal Server error if `page` is higher then max int #2175

Open sascha-egerer opened 5 years ago

sascha-egerer commented 5 years ago

If the tx_solr[page] is higher then a 32 bit integer (2147483647) an exception is thrown.

In master i would say this should be handled by solarium first. I've already created an issue https://github.com/solariumphp/solarium/issues/640

What do you think about a fix in the other branches? Should it be fixed? Then I'll prepare a pull request. I would simply limit the value to an integer by min($offset, 2147483647)

sascha-egerer commented 11 months ago

This issue does still exist and throws an exception that is not handled

Example (using 9223372036854775808 due to 64 bit system): https://www.typo3-solr.com/search/?tx_solr%5Bpage%5D=9223372036854775808&tx_solr%5Bq%5D=a

ApacheSolrForTypo3\Solr\System\Solr\SolrCommunicationException: Invalid query. Solr returned an error: 400 Bad Request in /var/www/html/private/typo3conf/ext/solr/Classes/System/Solr/Service/SolrReadService.php:125
Stack trace:
#0 /var/www/html/private/typo3conf/ext/solr/Classes/System/Solr/Service/SolrReadService.php(59): ApacheSolrForTypo3\Solr\System\Solr\Service\SolrReadService->handleErrorResponse(Object(ApacheSolrForTypo3\Solr\System\Solr\ResponseAdapter))
#1 /var/www/html/private/typo3conf/ext/solr/Classes/Search.php(142): ApacheSolrForTypo3\Solr\System\Solr\Service\SolrReadService->search(Object(ApacheSolrForTypo3\Solr\Domain\Search\Query\SearchQuery))
#2 /var/www/html/private/typo3conf/ext/solr/Classes/Domain/Search/ResultSet/SearchResultSetService.php(311): ApacheSolrForTypo3\Solr\Search->search(Object(ApacheSolrForTypo3\Solr\Domain\Search\Query\SearchQuery), 51539607504)
#3 /var/www/html/private/typo3conf/ext/solr/Classes/Domain/Search/ResultSet/SearchResultSetService.php(208): ApacheSolr {clipped}
dkd-kaehm commented 11 months ago

@sascha-egerer Thanks for reporting and tracking that issue. I would propose to react on that with something like "UnsupportedApacheSolrParamValueTypeException" on overflow, but not change the value and use it on query.

Could you provide a pull-request for that issue?