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

Call libmongoc is_valid functions before completing WriteConcern and ReadPreference initialization

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 1.8.0-beta2, 1.8.0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None

      mongoc_write_concern_is_valid is called only once in the driver near the end of php_phongo_apply_wc_options_to_uri.

      mongoc_read_prefs_is_valid is called from php_phongo_apply_rp_options_to_uri and at the end of the ReadPreference constructor. As discussed in a PR comment for PHPC-1571, calling this at the end of the constructor likely serves as a fail safe in case we missed throwing a more helpful exception for incompatible options.

      I'd propose we these is_valid checks from each class' init_from_hash function, as well as introduce a final call to mongoc_write_concern_is_valid in the WriteConcern constructor.

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

              Created:
              Updated:
              Resolved: