Call libmongoc is_valid functions before completing WriteConcern and ReadPreference initialization

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Fixed
    • Priority: Minor - P4
    • 1.8.0-beta2, 1.8.0
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • 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
            Reporter:
            Jeremy Mikola
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: