Skip to content

Commit 6354000

Browse files
authored
PHPC-2104: ClientEncryption::QUERY_TYPE_EQUALITY is a string (#1334)
* Define additional constants in mongocrypt-export.h * PHPC-2104: ClientEncryption::QUERY_TYPE_EQUALITY is a string Downstream change since MONGOC_ENCRYPT_QUERY_TYPE_EQUALITY was changed to a string type. Bumps libmongocrypt submodule to 1.5.0-rc2. Related to this bump, mongocrypt.h is no longer generated. Bumps libmongoc submodule to 1.22-dev.
1 parent 03fcb6b commit 6354000

File tree

9 files changed

+25
-14
lines changed

9 files changed

+25
-14
lines changed

config.m4

-1
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,6 @@ if test "$PHP_MONGODB" != "no"; then
495495

496496
AC_CONFIG_FILES([
497497
${ac_config_dir}/src/libmongocrypt/src/mongocrypt-config.h
498-
${ac_config_dir}/src/libmongocrypt/src/mongocrypt.h
499498
])
500499
fi
501500
fi

config.w32

-6
Original file line numberDiff line numberDiff line change
@@ -313,12 +313,6 @@ if (PHP_MONGODB != "no") {
313313
configure_module_dirname + "/src/libmongocrypt/src/mongocrypt-config.h",
314314
mongocrypt_opts
315315
);
316-
317-
mongodb_generate_header(
318-
configure_module_dirname + "/src/libmongocrypt/src/mongocrypt.h.in",
319-
configure_module_dirname + "/src/libmongocrypt/src/mongocrypt.h",
320-
mongocrypt_opts
321-
);
322316
} else if (PHP_MONGODB_CLIENT_SIDE_ENCRYPTION != "no") {
323317
// No SSL library found, we can't enable libmongocrypt
324318
WARNING("mongodb libmongocrypt support not enabled, crypto libs not found");

src/LIBMONGOCRYPT_VERSION_CURRENT

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.5.0-rc1
1+
1.5.0-rc2

src/LIBMONGOC_VERSION_CURRENT

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.22.0-beta0
1+
1.11.1-20220624+git711df87d6f

src/MongoDB/ClientEncryption.c

+11-2
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ void php_phongo_clientencryption_init_ce(INIT_FUNC_ARGS) /* {{{ */
211211
zend_declare_class_constant_string(php_phongo_clientencryption_ce, ZEND_STRL("AEAD_AES_256_CBC_HMAC_SHA_512_RANDOM"), MONGOC_AEAD_AES_256_CBC_HMAC_SHA_512_RANDOM);
212212
zend_declare_class_constant_string(php_phongo_clientencryption_ce, ZEND_STRL("ALGORITHM_INDEXED"), MONGOC_ENCRYPT_ALGORITHM_INDEXED);
213213
zend_declare_class_constant_string(php_phongo_clientencryption_ce, ZEND_STRL("ALGORITHM_UNINDEXED"), MONGOC_ENCRYPT_ALGORITHM_UNINDEXED);
214-
zend_declare_class_constant_long(php_phongo_clientencryption_ce, ZEND_STRL("QUERY_TYPE_EQUALITY"), MONGOC_ENCRYPT_QUERY_TYPE_EQUALITY);
214+
zend_declare_class_constant_string(php_phongo_clientencryption_ce, ZEND_STRL("QUERY_TYPE_EQUALITY"), MONGOC_ENCRYPT_QUERY_TYPE_EQUALITY);
215215
} /* }}} */
216216

217217
#ifdef MONGOC_ENABLE_CLIENT_SIDE_ENCRYPTION
@@ -538,7 +538,16 @@ static mongoc_client_encryption_encrypt_opts_t* phongo_clientencryption_encrypt_
538538
}
539539

540540
if (php_array_existsc(options, "queryType")) {
541-
mongoc_client_encryption_encrypt_opts_set_query_type(opts, php_array_fetch_long(options, "queryType"));
541+
char* querytype;
542+
int plen;
543+
zend_bool pfree;
544+
545+
querytype = php_array_fetch_string(options, "queryType", &plen, &pfree);
546+
mongoc_client_encryption_encrypt_opts_set_query_type(opts, querytype);
547+
548+
if (pfree) {
549+
efree(querytype);
550+
}
542551
}
543552

544553
return opts;

src/libmongoc

Submodule libmongoc updated 42 files

src/libmongocrypt

Submodule libmongocrypt updated 46 files
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
11
#ifndef MONGOCRYPT_EXPORT_H
22
#define MONGOCRYPT_EXPORT_H
33

4+
/* This file would typically be generated by libmongocrypt's CMake build process
5+
* so it must exist when building libmongocrypt as a submodule via Autotools. We
6+
* need only ensure this file exists and expected constants are defined, since
7+
* libmongocrypt APIs will not actually be exported.
8+
*
9+
* See: https://cmake.org/cmake/help/latest/module/GenerateExportHeader.html */
410
#define MONGOCRYPT_EXPORT
511
#define MONGOCRYPT_NO_EXPORT
12+
#define MONGOCRYPT_DEPRECATED
13+
#define MONGOCRYPT_DEPRECATED_EXPORT
14+
#define MONGOCRYPT_DEPRECATED_NO_EXPORT
615

716
#endif /* MONGOCRYPT_EXPORT_H */

tests/clientEncryption/clientEncryption-constants.phpt

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ string(43) "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic"
1717
string(36) "AEAD_AES_256_CBC_HMAC_SHA_512-Random"
1818
string(7) "Indexed"
1919
string(9) "Unindexed"
20-
int(0)
20+
string(8) "equality"
2121
===DONE===

0 commit comments

Comments
 (0)