|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59511 Unable to catch SolrClient::query
Submitted: 2010-11-15 18:23 UTC Modified: 2014-02-14 01:52 UTC
Avg. Score:4.5 ± 0.5
Reproduced:3 of 3 (100.0%)
Same Version:2 (66.7%)
Same OS:2 (66.7%)
From: eric dot caron at gmail dot com Assigned: omars (profile)
Status: Closed Package: solr (PECL)
PHP Version: 5.3.2 OS: Windows
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: eric dot caron at gmail dot com
New email:
PHP Version: OS:


 [2010-11-15 18:23 UTC] eric dot caron at gmail dot com
(Error is from 0.9.10, $Revision: 298824$, but 11 changes in SVN since then don't address anything like this).

PHP's documentation for SolrClient::query says "Returns a SolrQueryResponse object on success and throws a SolrClientException object on failure."

So when trying to catch the error if the server is unresponsive, a try/catch should prevent the timeout errors from being viewed by users. For testing, I've been pointing the Solr client to, where x is larger than SOLR_TIMEOUT. The timeout does occur, but I can't catch it.

Reproduce code:
$solr_options = array(
'port'     => SOLR_SERVER_PORT,
'path'     => SOLR_PATH,
'timeout' => SOLR_TIMEOUT,
$sc = new SolrClient($solr_options);
try {
	$query_response = $sc->query("lucene");
} catch(SolrException $e){
	echo "An error occurred.";

Expected result:
An error occurred.

Actual result:
PHP Warning: SolrClient::query() [solrclient.query]: Solr HTTP Error : 'Timeout was reached'...


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2011-03-28 15:25 UTC] dorgan at donaldorgan dot com
Thats because PHP is seeing it as a warning...The module 
should be changed to throw an error.  Then it will be 
 [2011-06-04 04:20 UTC]
Working on this.

Will change to exception after testing is complete.
 [2014-02-14 01:52 UTC]
-Assigned To: iekpo +Assigned To: omars
 [2014-02-14 18:46 UTC]
Automatic comment on behalf of omars
Log: Fixed Bug #59511, SolrClient::query() were producing warning + SolrClientException on http error
 [2014-02-14 18:46 UTC]
-Status: Assigned +Status: Closed
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Nov 28 23:03:13 2021 UTC