Uploaded image for project: 'PHP Driver: Extension'
  1. PHP Driver: Extension
  2. PHPC-2513

BulkWrite::insert() should not append document if PHONGO_BSON_RETURN_ID fails

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 1.21.0
    • Affects Version/s: None
    • Component/s: None
    • None
    • PHP Drivers
    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      In mongodb/mongo-php-driver#1763 (PHPC-2478), andreas.braun@mongodb.com pointed out that an unlikely failure of php_phongo_zval_to_bson() to populate bson_out for PHONGO_BSON_RETURN_ID would result in throwing an exception after the document was already appended to the bulk write.

      That code for BulkWriteCommand::insertOne() was modeled after existing code in BulkWrite::insert(), so this ticket can serve to address the original logic in BulkWrite::insert().

            Assignee:
            jmikola@mongodb.com Jeremy Mikola
            Reporter:
            jmikola@mongodb.com Jeremy Mikola
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: