Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit cd1622e

Browse files
committed
Check for _id extraction before appending insert
1 parent 7d092b7 commit cd1622e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

‎src/MongoDB/BulkWriteCommand.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -437,18 +437,18 @@ static PHP_METHOD(MongoDB_Driver_BulkWriteCommand, insertOne)
437437
goto cleanup;
438438
}
439439

440+
if (!bson_out) {
441+
phongo_throw_exception(PHONGO_ERROR_LOGIC, "php_phongo_zval_to_bson() did not return an _id. Please file a bug report.");
442+
goto cleanup;
443+
}
444+
440445
if (!mongoc_bulkwrite_append_insertone(intern->bw, ns, &bdocument, NULL, &error)) {
441446
phongo_throw_exception_from_bson_error_t(&error);
442447
goto cleanup;
443448
}
444449

445450
intern->num_ops++;
446451

447-
if (!bson_out) {
448-
phongo_throw_exception(PHONGO_ERROR_LOGIC, "php_phongo_zval_to_bson() did not return document identifier. Please file a bug report.");
449-
goto cleanup;
450-
}
451-
452452
phongo_bwc_extract_id(bson_out, &return_value);
453453

454454
cleanup:

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /