Skip to content

Commit 7b20974

Browse files
committed
PHPLIB-45: Support stdClass listCollections() filter option
1 parent 99fa534 commit 7b20974

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Database.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,9 @@ private function listCollectionsLegacy(Server $server, array $options = array())
164164
throw new InvalidArgumentException(sprintf('Expected filter to be array or object, %s given', gettype($filter)));
165165
}
166166

167-
if (array_key_exists('name', $filter)) {
167+
if (array_key_exists('name', (array) $filter)) {
168+
$filter = (array) $filter;
169+
168170
if ( ! is_string($filter['name'])) {
169171
throw new InvalidArgumentException(sprintf('Filter "name" must be a string for MongoDB <2.8, %s given', gettype($filter['name'])));
170172
}

0 commit comments

Comments
 (0)