Skip to content

Commit 6dd4fff

Browse files
committed
Check for empty error_reply instead of NULL
mongoc_bulkwriteexception_errorreply() always returns an initialized document, but it may be empty. This ensures that an InvalidArgumentException is not unnecessarily proxied behind a BulkWriteCommandException.
1 parent dc7135f commit 6dd4fff

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/phongo_execute.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ bool phongo_execute_bulkwritecommand(zval* manager, php_phongo_bulkwritecommand_
430430
* (CDRIVER-5842). Throw InvalidArgumentException directly iff there is
431431
* neither a partial write result nor an error reply (we can assume
432432
* there are no write or write concern errors for this case). */
433-
if (EG(exception) && EG(exception)->ce == php_phongo_invalidargumentexception_ce && !bw_ret.res && !error_reply) {
433+
if (EG(exception) && EG(exception)->ce == php_phongo_invalidargumentexception_ce && !bw_ret.res && bson_empty(error_reply)) {
434434
goto cleanup;
435435
}
436436

0 commit comments

Comments
 (0)