File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change 1+ --TEST--
2+ PHPC-1045: Segfault if username is not provided for SCRAM-SHA-1 authMechanism
3+ --SKIPIF--
4+ <?php require __DIR__ . "/../utils/basic-skipif.inc " ; ?>
5+ <?php NEEDS ('STANDALONE ' ); CLEANUP (STANDALONE ); ?>
6+ --FILE--
7+ <?php
8+
9+ require_once __DIR__ . "/../utils/basic.inc " ;
10+
11+ // STANDALONE does not support auth, but that is not necessary for the test
12+ $ m = new MongoDB \Driver \Manager (STANDALONE , ['authMechanism ' => 'SCRAM-SHA-1 ' , 'ssl ' => false ]);
13+
14+ // Execute a basic ping command to trigger connection initialization
15+ echo throws (function () use ($ m ) {
16+ $ m ->executeCommand ('admin ' , new MongoDB \Driver \Command (['ping ' =>1 ]));
17+ }, 'MongoDB\Driver\Exception\RuntimeException ' ), "\n" ;
18+
19+ ?>
20+ ===DONE===
21+ <?php exit (0 ); ?>
22+ --EXPECTF--
23+ OK: Got MongoDB\Driver\Exception\RuntimeException
24+ SCRAM Failure: username is not set
25+ ===DONE===
You can’t perform that action at this time.
0 commit comments