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

Remove php_phongo_write_concern_to_zval and allow WriteConcern object in BulkWrite debug output

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • 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?

      As noted in this comment thread for PHPC-1411, php_phongo_write_concern_to_zval is only used when generating debug info for a BulkWrite object.

      I believe we can remove this function entirely by modifying php_phongo_bulkwrite_get_debug_info to delete php_phongo_write_concern_to_zval in favor of calling phongo_writeconcern_init. The only side effect that I noticed from doing so is that the debug output of BulkWrite may now include a WriteConcern object instead of a flat array. I don't recall the original motivation for creating php_phongo_write_concern_to_zval, but I don't see an issue with the debug output having objects within it as that's what one might expect for userland PHP classes.

      Note that a BulkWrite will only have a WriteConcern after it has been executed, so we have very little test coverage for this function. Most var_dump() expectations for BulkWrite objects are pre-execution and expect a NULL write concern. AFAIK, only write-0002.php provides code coverage, and even then only for a single write concern.

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

              Created:
              Updated: