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

Require object or array type for "kmsProviders" option

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 1.7.0
    • Affects Version/s: 1.7.0
    • Component/s: None
    • None

      While reviewing PHPC-1532 and the documentation for "kmsProviders", I wondered what would happen if a PHP value other than an object or array was specified. I believe php_phongo_zval_to_bson_internal will no-op in that case and leave bson_providers as-is, which will result in an empty document being passed to mongoc_auto_encryption_opts_set_kms_providers. Presumably, libmongocrypt will later raise an error since neither the "aws" nor "local" key was specified.

      I think we'd do well to raise an exception if an object or array is not specified, similar to what we do in php_phongo_query_opts_append_document and other argument validation methods.

      This came up with respect to createClientEncryption, but it may also apply to "kmsProviders", "schemaMap", and "extraOptions" under the "autoEncryption" driver option. If you end up addressing all three options with this issue, feel free to amend the title as needed.

            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: