We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 03d68ca + 9fd5905 commit da8fac1Copy full SHA for da8fac1
tests/cursor/bug0920-001.phpt
@@ -0,0 +1,24 @@
1
+--TEST--
2
+PHPC-924: Using a projection with an empty field name causes a crash when destroying cursor
3
+--SKIPIF--
4
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE) ?>
5
+--FILE--
6
+<?php
7
+require_once __DIR__ . "/../utils/basic.inc";
8
+
9
+$manager = new MongoDB\Driver\Manager(STANDALONE);
10
11
+$query = new MongoDB\Driver\Query([], ['projection' => ['' => 1]]);
12
13
+echo throws(function() use ($manager, $query) {
14
+ $cursor = $manager->executeQuery(NS, $query);
15
+ var_dump($cursor->toArray());
16
+}, 'MongoDB\Driver\Exception\RuntimeException'), "\n";
17
18
+?>
19
+===DONE===
20
+<?php exit(0); ?>
21
+--EXPECT--
22
+OK: Got MongoDB\Driver\Exception\RuntimeException
23
+Cannot use empty keys in 'opts'.
24
0 commit comments