Skip to content

Commit 41dd0b9

Browse files
committed
Merged pull request #919
2 parents c9e9fcb + ee1d425 commit 41dd0b9

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

php_phongo.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,10 @@ zend_class_entry* phongo_exception_from_mongoc_domain(uint32_t /* mongoc_error_d
166166
return php_phongo_serverexception_ce;
167167
}
168168

169+
if (domain == MONGOC_ERROR_PROTOCOL && code == MONGOC_ERROR_PROTOCOL_BAD_WIRE_VERSION) {
170+
return php_phongo_connectionexception_ce;
171+
}
172+
169173
return php_phongo_runtimeexception_ce;
170174
}
171175
void phongo_throw_exception(php_phongo_error_domain_t domain TSRMLS_DC, const char* format, ...)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
--TEST--
2+
MongoDB\Driver\Manager::__construct(): wire version support
3+
--FILE--
4+
<?php
5+
require_once __DIR__ . "/../utils/basic.inc";
6+
7+
$manager = new \MongoDB\Driver\Manager(URI);
8+
9+
$command = new MongoDB\Driver\Command(['ping' => 1]);
10+
try {
11+
$manager->executeCommand("test", $command);
12+
} catch (\MongoDB\Driver\Exception\ConnectionException $e) {
13+
if ($e->getCode() == 15) { // Bad Wire Version
14+
echo "Bad wire version detected: ", $e->getMessage(), "\n";
15+
}
16+
}
17+
?>
18+
===DONE===
19+
--EXPECT--
20+
===DONE===

0 commit comments

Comments
 (0)