Apply a limit to results fetched via Ldap\Connection::fetchRow()
fixes #7993
This commit is contained in:
parent
6e533f223e
commit
3e128732b8
|
@ -242,7 +242,8 @@ class Connection
|
||||||
*/
|
*/
|
||||||
public function fetchRow($query, $fields = array())
|
public function fetchRow($query, $fields = array())
|
||||||
{
|
{
|
||||||
// TODO: This is ugly, make it better!
|
$query = clone $query;
|
||||||
|
$query->limit(1);
|
||||||
$results = $this->fetchAll($query, $fields);
|
$results = $this->fetchAll($query, $fields);
|
||||||
return array_shift($results);
|
return array_shift($results);
|
||||||
}
|
}
|
||||||
|
@ -365,7 +366,7 @@ class Connection
|
||||||
$query->create(),
|
$query->create(),
|
||||||
empty($fields) ? $query->listFields() : $fields,
|
empty($fields) ? $query->listFields() : $fields,
|
||||||
0, // Attributes and values
|
0, // Attributes and values
|
||||||
0 // No limit - at least where possible
|
$query->hasLimit() ? $query->getOffset() + $query->getLimit() : 0 // No limit - at least where possible
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($results === false) {
|
if ($results === false) {
|
||||||
|
|
Loading…
Reference in New Issue