@@ -1278,6 +1278,33 @@ static bool phongo_manager_set_auto_encryption_opts(php_phongo_manager_t* manage
1278
1278
1279
1279
auto_encryption_opts = mongoc_auto_encryption_opts_new ();
1280
1280
1281
+ if (php_array_existsc (zAutoEncryptionOpts , "bypassAutoEncryption" )) {
1282
+ mongoc_auto_encryption_opts_set_bypass_auto_encryption (auto_encryption_opts , php_array_fetch_bool (zAutoEncryptionOpts , "bypassAutoEncryption" ));
1283
+ }
1284
+
1285
+ if (php_array_existsc (zAutoEncryptionOpts , "bypassQueryAnalysis" )) {
1286
+ mongoc_auto_encryption_opts_set_bypass_query_analysis (auto_encryption_opts , php_array_fetch_bool (zAutoEncryptionOpts , "bypassQueryAnalysis" ));
1287
+ }
1288
+
1289
+ if (php_array_existsc (zAutoEncryptionOpts , "encryptedFieldsMap" )) {
1290
+ zval * enc_fields_map = php_array_fetch (zAutoEncryptionOpts , "encryptedFieldsMap" );
1291
+ bson_t bson_map = BSON_INITIALIZER ;
1292
+
1293
+ if (Z_TYPE_P (enc_fields_map ) != IS_OBJECT && Z_TYPE_P (enc_fields_map ) != IS_ARRAY ) {
1294
+ phongo_throw_exception (PHONGO_ERROR_INVALID_ARGUMENT , "Expected \"encryptedFieldsMap\" encryption option to be an array or object" );
1295
+ goto cleanup ;
1296
+ }
1297
+
1298
+ php_phongo_zval_to_bson (enc_fields_map , PHONGO_BSON_NONE , & bson_map , NULL );
1299
+ if (EG (exception )) {
1300
+ goto cleanup ;
1301
+ }
1302
+
1303
+ mongoc_auto_encryption_opts_set_encrypted_fields_map (auto_encryption_opts , & bson_map );
1304
+
1305
+ bson_destroy (& bson_map );
1306
+ }
1307
+
1281
1308
if (php_array_existsc (zAutoEncryptionOpts , "keyVaultClient" )) {
1282
1309
zval * key_vault_client = php_array_fetch (zAutoEncryptionOpts , "keyVaultClient" );
1283
1310
@@ -1388,12 +1415,6 @@ static bool phongo_manager_set_auto_encryption_opts(php_phongo_manager_t* manage
1388
1415
bson_destroy (& bson_options );
1389
1416
}
1390
1417
1391
- if (php_array_existsc (zAutoEncryptionOpts , "bypassAutoEncryption" )) {
1392
- zend_bool bypass_auto_encryption = php_array_fetch_bool (zAutoEncryptionOpts , "bypassAutoEncryption" );
1393
-
1394
- mongoc_auto_encryption_opts_set_bypass_auto_encryption (auto_encryption_opts , bypass_auto_encryption );
1395
- }
1396
-
1397
1418
if (php_array_existsc (zAutoEncryptionOpts , "extraOptions" )) {
1398
1419
zval * extra_options = php_array_fetch (zAutoEncryptionOpts , "extraOptions" );
1399
1420
bson_t bson_options = BSON_INITIALIZER ;
0 commit comments