Skip to content

Commit 39b740a

Browse files
committed
PHPLIB-473: Don't override writeConcern when in a transaction
1 parent 8e86569 commit 39b740a

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/Client.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ public function dropDatabase($databaseName, array $options = [])
172172

173173
$server = select_server($this->manager, $options);
174174

175-
if (! isset($options['writeConcern']) && server_supports_feature($server, self::$wireVersionForWritableCommandWriteConcern)) {
175+
if (! isset($options['writeConcern']) && server_supports_feature($server, self::$wireVersionForWritableCommandWriteConcern) && ! is_in_transaction($options)) {
176176
$options['writeConcern'] = $this->writeConcern;
177177
}
178178

src/Database.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ public function createCollection($collectionName, array $options = [])
282282

283283
$server = select_server($this->manager, $options);
284284

285-
if (! isset($options['writeConcern']) && server_supports_feature($server, self::$wireVersionForWritableCommandWriteConcern)) {
285+
if (! isset($options['writeConcern']) && server_supports_feature($server, self::$wireVersionForWritableCommandWriteConcern) && ! is_in_transaction($options)) {
286286
$options['writeConcern'] = $this->writeConcern;
287287
}
288288

@@ -309,7 +309,7 @@ public function drop(array $options = [])
309309

310310
$server = select_server($this->manager, $options);
311311

312-
if (! isset($options['writeConcern']) && server_supports_feature($server, self::$wireVersionForWritableCommandWriteConcern)) {
312+
if (! isset($options['writeConcern']) && server_supports_feature($server, self::$wireVersionForWritableCommandWriteConcern) && ! is_in_transaction($options)) {
313313
$options['writeConcern'] = $this->writeConcern;
314314
}
315315

@@ -337,7 +337,7 @@ public function dropCollection($collectionName, array $options = [])
337337

338338
$server = select_server($this->manager, $options);
339339

340-
if (! isset($options['writeConcern']) && server_supports_feature($server, self::$wireVersionForWritableCommandWriteConcern)) {
340+
if (! isset($options['writeConcern']) && server_supports_feature($server, self::$wireVersionForWritableCommandWriteConcern) && ! is_in_transaction($options)) {
341341
$options['writeConcern'] = $this->writeConcern;
342342
}
343343

@@ -444,7 +444,7 @@ public function modifyCollection($collectionName, array $collectionOptions, arra
444444

445445
$server = select_server($this->manager, $options);
446446

447-
if (! isset($options['writeConcern']) && server_supports_feature($server, self::$wireVersionForWritableCommandWriteConcern)) {
447+
if (! isset($options['writeConcern']) && server_supports_feature($server, self::$wireVersionForWritableCommandWriteConcern) && ! is_in_transaction($options)) {
448448
$options['writeConcern'] = $this->writeConcern;
449449
}
450450

0 commit comments

Comments
 (0)