24 Commits

Author SHA1 Message Date
Andreas Braun a4b536aa6a PHPC-2403: Remove optional sparsity and trimFactor options (#1628) 2024-09-05 08:20:08 +02:00
Jeremy Mikola 4956b57028 PHPC-2401: Support QEv2 range protocol (#1583)
Existing RANGE_PREVIEW constants are deprecated in favor of new RANGE constants introduced in libmongoc 1.28.0. PHP 8.3+ emits deprecation messages when accessing the RANGE_PREVIEW constants, so we ignore such output in the constants test. It wasn't worth splitting that test by PHP version.

Support trimFactor range option.

Specify default value for trimFactor range option in tests. This is temporary until sparsity and trimFactor are made optional prior to the GA release for range indexes (PHPC-2403).
2024-06-14 10:17:36 -04:00
Jeremy Mikola e9098a56e4 PHPC-2219: Prohibit serializing PackedArray as root documents (#1480)
* PHPC-2219: Prohibit serializing PackedArray as root documents

This adds logic to php_phongo_zval_to_bson_internal() to prohibit serializing PackedArray instances as a root document. Since this function is also used in specific cases to encode a BSON array, a PHONGO_BSON_ALLOW_ROOT_ARRAY flag is introduced to relax the restriction.

* Check if existing field_path element must be freed before overwriting

* Remove function name from Javascript code strings
2023-10-16 13:16:37 -04:00
Andreas Braun 2ab1e4ba2e PHPC-2230: Drop support for PHP 7.2 and 7.3 (#1450)
* PHPC-2230: Drop support for PHP 7.2 and 7.3

* Remove compatibility code for PHP < 7.4

* Drop tests for legacy PHP serialization behaviour

* Remove type match regexes in tests

* Match object properties as strings

* Fix var_export format in tests

* Use wildcards when matching object properties

* Remove unnecessary matching pattern in __set_state tests
2023-08-16 13:50:15 +02:00
Jeremy Mikola b93f7c2bd1 PHPC-2197: Support queryable encryption range indexes (#1409)
* Implement ClientEncryption::encryptExpression()

Define algorithm and query type constants for range preview

* Handle BSON encoding exceptions in encrypt/decrypt

Note that it is not possible to write a test for decrypt() since Binary instances always encode to BSON.
2023-05-30 07:27:41 -04:00
Andreas Braun 2e27d1b540 PHPC-2188: Test that tlsDisableOCSPEndpointCheck is allowed in CSFLE options (#1402) 2023-02-02 10:58:10 +01:00
Jeremy Mikola 411a022bcd PHPC-2148: Prohibit masterKey without provider for rewrapManyDataKey 2022-10-14 16:48:59 +08:00
Jeremy Mikola d060b94c2d PHPC-2151: Validate masterKey option in createDataKey() and rewrapManyDataKey() 2022-10-14 16:48:59 +08:00
Jeremy Mikola da5e12cc42 PHPC-2149: Ensure masterKey bson_t is freed in createDataKey() 2022-10-14 16:48:59 +08:00
Jeremy Mikola c99a8563bf PHPC-2093: Key Management API (#1339)
* PHPC-2120: Bump libmongoc 1.22.1 and libmongocrypt 1.5.2

* Clean keyvault collection before CSFLE tests

* Test invalid keyMaterial option for ClientEncryption::createDataKey()

* ClientEncryption::createDataKey() "keyMaterial" option

* ClientEncryption key management methods

Use ClientEncryption::getKey in createDataKey tests

* Require server 4.2+ for CSFLE integration tests

* Accommodate PHP 7.2 error message in createDataKey error test
2022-08-18 12:15:54 -04:00
Jeremy Mikola 63540009f7 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.
2022-06-24 14:59:17 -04:00
Jeremy Mikola 03fcb6b9ef PHPC-2099: crypt_shared testing (#1333)
* Use non-breaking space in OS axis labels

* Revise titles and Manager construction in autoEncryption tests

* Define CSFLE_KEY_VAULT_NS and CSFLE_LOCAL_KEY constants

The value for CSFLE_KEY_VAULT_NS is based on the example from PHPLIB-826. This was not required but helps makes all tests consistent and will make it easier if we need to add functionality to a helper to drop the key vault collection before a test.

Using CSFLE_LOCAL_KEY allows removal of a duplicated string literal in various CSFLE tests. Although the new constant wasn't required for all tests (empty strings worked fine to satisfy option validation), using a constant helps ensure consistency across the test suite.

Also use create_test_manager() in more places when basic.inc is included. The remaining instances of direct Manager construction should only be in tests where basic.inc isn't used.
2022-06-22 13:37:56 -04:00
Jeremy Mikola 6b8f5c20a6 PHPC-2097: Enable ClientEncryption constructor 2022-05-31 18:59:22 -04:00
Jeremy Mikola 1b8543b42f PHPC-2092: ClientEncryption options for queryable encryption
Several new constants for these options have been introduced.
2022-05-31 18:59:22 -04:00
Jeremy Mikola 93efe0aeb6 PHPC-2073: Remove references to pre-3.6 servers (#1305)
* Remove pre-3.6 server versions from Evergreen matrix

* Remove skipped tests for pre-3.6 servers

* Remove old mongo-orchestration configs and Evergreen tasks

* Remove flaky replica set tests

These tests assume a particular replica set member is always the primary, so tag assertions may fail if a different member is elected. The server-getTags-002.phpt test has more flexible assertions for replica set tags, so we can safely remove these tests.
2022-03-01 20:30:00 -05:00
Andreas Braun deead9687e PHPC-1716 Allow configuring server API version in manager (#1204)
* Introduce MongoDB\Driver\ServerApi

* Accept serverApi driver option

* Introduce create_test_manager factory to create manager

A centralised entry point is required to inject the API_VERSION env variable later.

* Add build variant to test with requireApiVersion=true

* Fix wrong configuration for auth variable

This changed when migrating from our own scripts to drivers-evergreen-tools and was not updated properly, causing all tests to run with auth disabled.

* Declare ZEND_PARSE_PARAMETERS_NONE macro

This macro is missing on PHP < 7.3

* Remove duplicated API param storage

* Add missing semicolons

* Add ZEND_PARSE_PARAMETERS_NON_EX macro

* Extract error handling functionality to separate macros

* Throw if internal mongoc_server_api_t is already initialised

* Use imported namespaces in tools file

* Fix type info for reflection

* Use American English spelling

* Only use typed serialize signature on PHP 8+

* Update PHONGO_PARSE_PARAMETERS_NONE macro for PHP < 7.3

* Remove usage of ZEND_STRL within zend_hash_str_add

This causes compile failures on PHP < 7.3 that I have yet to understand.

* Fix errors in new PHONGO_PARSE_PARAMETERS macros
2021-03-26 15:43:48 +01:00
Andreas Braun e52207de8a PHPC-1499: Skip encryption tests on MMAPv1 storage engine 2020-02-03 14:59:51 +01:00
Andreas Braun 3c10a498e3 Move createClientEncryption tests to manager folder 2020-01-31 08:35:14 +01:00
Andreas Braun b8c8523e1c PHPC-1545: Improve checks for invalid encryption option types 2020-01-30 15:00:17 +01:00
Andreas Braun c54bbaac67 PHPC-1499: Declare class constants for encryption algorithms 2020-01-22 08:18:32 +01:00
Andreas Braun f0372a50c5 PHPC-1499: Implement ClientEncryption::decrypt 2020-01-22 08:18:32 +01:00
Andreas Braun 4d7b35ee69 PHPC-1499: Implement ClientEncryption::encrypt 2020-01-22 08:18:32 +01:00
Andreas Braun e65a933c8f PHPC-1499: Implement ClientEncryption::createDataKey 2020-01-22 08:18:32 +01:00
Andreas Braun 4923bdd97b PHPC-1499: Add empty ClientEncryption class 2020-01-22 08:18:32 +01:00