pecl-search_engine-solr
pecl-search_engine-solr copied to clipboard
TypeError in SolrQuery
I am getting TypeErrors when calling some methods on a SolrQuery
object when using strict_types.
Methods found with problems:
-
setStart()
-
setRows()
-
setTimeAllowed()
-
setGroupOffset()
-
setExpandRows()
All of these "say" they want an integer first argument, but throw a TypeError saying thay want strings.
Example:
<?php declare(strict_types=1);
$query = new SolrQuery('lucene');
$query->setStart(1);
No error is expected, but this is the result:
PHP Warning: SolrQuery::setStart(): Invalid parameters in ps.php on line 3
PHP Stack trace:
PHP 1. {main}() ps.php:0
PHP 2. SolrQuery->setStart($start = 1) ps.php:3
PHP Fatal error: Uncaught TypeError: SolrQuery::setStart(): Argument #1 ($start) must be of type string, int given in ps.php:3
Stack trace:
#0 ps.php(3): SolrQuery->setStart()
#1 {main}
thrown in ps.php on line 3
Tested on 7.1, 7.2, 7.3, 7.4, 8.0 and 8.1.
(I am working on a PR to fix this)