Skip to content

Commit 25ca0a5

Browse files
committed
Merge pull request #1054
2 parents b113838 + 20db35a commit 25ca0a5

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

php_phongo.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2720,7 +2720,7 @@ void phongo_manager_init(php_phongo_manager_t* manager, const char* uri_string,
27202720
}
27212721

27222722
#ifdef MONGOC_ENABLE_SSL
2723-
if (ssl_opt && mongoc_uri_get_tls(uri)) {
2723+
if (ssl_opt) {
27242724
mongoc_client_set_ssl_opts(manager->client, ssl_opt);
27252725
}
27262726
#endif
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
--TEST--
2+
MongoDB\Driver\Manager::__construct(): Specifying a driver option implicitly enables TLS
3+
--SKIPIF--
4+
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
5+
<?php skip_if_not_libmongoc_ssl(['OpenSSL', 'LibreSSL']); ?>
6+
<?php skip_if_ssl(); ?>
7+
--FILE--
8+
<?php
9+
10+
require_once __DIR__ . "/../utils/basic.inc";
11+
12+
// Ensure that the server is up to ensure we're not hitting a different failure below
13+
$manager = new MongoDB\Driver\Manager(URI);
14+
$manager->executeCommand(DATABASE_NAME, new MongoDB\Driver\Command(['ping' => 1]));
15+
16+
$manager = new MongoDB\Driver\Manager(URI, [], ['ca_dir' => 'foo']);
17+
18+
echo throws(function () use ($manager) {
19+
// Note that this command will not fail if the server was configured with allowSSL or preferSSL for net.ssl.mode.
20+
$manager->executeCommand(DATABASE_NAME, new MongoDB\Driver\Command(['ping' => true]));
21+
}, MongoDB\Driver\Exception\ConnectionTimeoutException::class), "\n";
22+
23+
?>
24+
===DONE===
25+
--EXPECTF--
26+
OK: Got MongoDB\Driver\Exception\ConnectionTimeoutException
27+
No suitable servers found (`serverSelectionTryOnce` set): %s
28+
===DONE===

0 commit comments

Comments
 (0)