-
Notifications
You must be signed in to change notification settings - Fork 43
Closed
Description
The Query->count() contains the following line:
return $this->__resultSet->total();
But the Query->_execute() method assigns directly the result of the webservice request to $this->__resultSet without checking the returned type:
return $this->__resultSet = $this->_webservice->execute($this);
and according to the doc, the WebserviceInterface->execute() function may return a ResultSet, but also an integer or a boolean:
@return \Muffin\Webservice\ResultSet|int|bool
Therefore for example if the webservice request fails and returns false, $this->__resultSet does not have any total() method and an error is raised.
A solution could be :
if(method_exists($this->__resultSet, 'total')) {
return $this->__resultSet->total();
} else {
return false;
}
or
if(is_a($this->__resultSet, '\Cake\Datasource\ResultSetInterface')) {
return $this->__resultSet->total();
} else {
return false;
}
Metadata
Metadata
Assignees
Labels
No labels