basho / riak-php-client

PHP clients for Riak
Apache License 2.0
160 stars 69 forks source link

If a malformed search query is sent to Riak, the API starts throwing notices and warnings [JIRA: CLIENTS-597] #103

Closed karlra closed 8 years ago

karlra commented 8 years ago

The notification are: Notice: Undefined property: stdClass::$response in \vendor\basho\riak\src\Riak\Command\Search\Response.php on line 40

Notice: Trying to get property of non-object in \vendor\basho\riak\src\Riak\Command\Search\Response.php on line 40

Warning: Invalid argument supplied for foreach() in \vendor\basho\riak\src\Riak\Command\Search\Response.php on line 40

The issue is that the $response property doesn't exist for malformed queries. It would probably be better to throw Exceptions in this situation.

$response = (new \Basho\Riak\Command\Builder\Search\FetchObjects($riak)) ->withIndexName('myindex') ->withQuery('ffffff') ->build() ->execute();

christophermancini commented 8 years ago

@karlra thanks for bringing this to our attention, I will check into it.

christophermancini commented 8 years ago

Closing this out, please comment if you still encounter issues.