Skip to content

Commit bfbbbf1

Browse files
committed
Regression test for empty command segfault (CDRIVER-2431)
1 parent e7d88b1 commit bfbbbf1

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
--TEST--
2+
MongoDB\Driver\Manager::executeCommand() with empty command document
3+
--SKIPIF--
4+
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
5+
<?php NEEDS('STANDALONE'); ?>
6+
--FILE--
7+
<?php
8+
require_once __DIR__ . "/../utils/basic.inc";
9+
10+
$manager = new MongoDB\Driver\Manager(STANDALONE);
11+
$command = new MongoDB\Driver\Command([]);
12+
13+
echo throws(function() use ($manager, $command) {
14+
$manager->executeCommand(DATABASE_NAME, $command);
15+
}, 'MongoDB\Driver\Exception\InvalidArgumentException'), "\n";
16+
17+
?>
18+
===DONE===
19+
<?php exit(0); ?>
20+
--EXPECT--
21+
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
22+
Empty command document
23+
===DONE===

0 commit comments

Comments
 (0)