From ce62464142489a71b37da47720a0e66be0ae2ac8 Mon Sep 17 00:00:00 2001 From: Shimon Newman Date: Mon, 20 Oct 2025 13:59:40 +0300 Subject: [PATCH] Update src/Client.php Co-authored-by: Jake Barnby --- src/Client.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Client.php b/src/Client.php index 7a20dfd505..1d54284cb3 100644 --- a/src/Client.php +++ b/src/Client.php @@ -330,8 +330,10 @@ class Client // MongoDB will reject commands with readConcern that have txnNumber but not startTransaction // Or if the command is in the readConcernNotSupporteedCommands array if (((isset($command['txnNumber']) && !isset($command['startTransaction']) && isset($command['readConcern'])) - || - in_array(array_keys($command)[0] ?? '', $this->readConcernNotSupporteedCommands))) { + if ( + ((isset($command['txnNumber']) && !isset($command['startTransaction']) && isset($command['readConcern'])) + || \in_array(array_key_first($command) ?? '', $this->readConcernNotSupporteedCommands)) + ) { unset($command['readConcern']); }