Skip to content

Commit da8fac1

Browse files
committed
Merge pull request #557
2 parents 03d68ca + 9fd5905 commit da8fac1

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

tests/cursor/bug0920-001.phpt

+24
Original file line numberDiff line numberDiff line change
@@ -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+
===DONE===

0 commit comments

Comments
 (0)