* PHPC-2473: Bump to libmongoc 1.29.0
Update sources and paths for libmongoc 1.29.0.
Update libmongoc CI builds and re-enable "latest". Also updates the file paths in comment. The test-variants.yml file was moved in e128d2e182
* PHPC-2475: bson_as_legacy_extended_json replaces bson_as_json
* PHPC-2470: Vendor bson-atomic as phongo_atomic
libmongoc 1.29.0 deprecated bson-atomic.h, so this vendors the necessary functionality into PHPC. Also applied clang-format to the new sources.
* PHPC-2347: Deprecate BSON functions
* Remove deprecated functionality from BSON corpus tests
* Change test-only BSON functions to use BSON document class
* Fix changed test expectations
* Account for deprecations in BSON function tests
* Don't use deprecated functions in tests where possible
* Suggest replacement methods with deprecations
* Add SBOM file and script for updating it
* Update instructions for updating bundled code
* Apply suggestions from code review
Co-authored-by: Jeremy Mikola <jmikola@gmail.com>
* Improve instructions to update SBOM
---------
Co-authored-by: Jeremy Mikola <jmikola@gmail.com>
* PHPC-2382: Allow static builds with php-src
Prefer PHP_VERSION_ID for static builds, and fall back to invoking php-config otherwise.
mongocrypt.h previously used a path relative to the PHPC project root, which is not compatible with static builds. The current path is relative to src/, which is explicitly defined as an include path in config.m4.
* Preserve CPPFLAGS before modification by PlatformFlags.m4
PlatformFlags.m4 modifies CPPFLAGS in order to make checks in subsequent M4 scripts consistent with PHP_MONGODB_BUNDLED_CFLAGS. Restoring its original value after executing all M4 scripts will avoid unintended side effects on a static PHP build.
* Remove obsolete STD_CFLAGS assignments
STD_CFLAGS was never appended to PHP_MONGODB_BUNDLED_CFLAGS after these M4 scripts were run, so it's safe to assume they had no effect and can be removed entirely.
For CheckCompiler.m4, bumping the GCC requirement to 4.6 (still quite old) will ensure compatibility for libmongoc's BEGIN_IGNORE_DEPRECATIONS macro.
* Prefix names of internal CFLAGS vars in config.m4
* Remove obsolete comment in config.m4
This comment should have been removed in d8d30e5a88
* Include CPPFLAGS in build config output
Co-authored-by: Andreas Braun <git@alcaeus.org>
* PHPC-2311: Note that with-libbson and with-libmongoc are deprecated
* PHPC-2312: MONGOC_ENABLE_SASL_GSSAPI is obsolete
* PHPC-1218: Use m4_include with base path for including m4 scripts
This removes the custom _include macro, which used sinclude on two different paths in order to support both shared and static builds. Unlike m4_sinclude, m4_include reports an error if the file is not found, so this also addresses the validation that was disabled to support PECL installs.
* PHPC-2300 and PHPC-2302: Fix configure output for bundled libbson/libmongoc versions
This was missed in 7ccb0949ba and 1c533ffa2d.
* PHPC-2225: Validate PHP_ARG_ENABLE and PHP_ARG_WITH configure options
Introduce a PHP_MONGODB_VALIDATE_ARG macro, which is called after processing a configure option.
PHP may still assign "yes" as a value during parsing, so map that to another value when necessary (e.g. selecting a crypto/TLS library).
* Add deprecation notice for --enable-system-ciphers in shared builds
* PHPC-2155: Remove prefixes for quoted shell variable references
* PHPC-1017: Allow configure options to be specified with PECL install
Introducing <configureoption> tags in package.xml means that PECL installs will now prompt for input. Non-interactive installs can still be achieved by either piping input (e.g. `yes '' | pecl install mongodb`) or explicitly specifying configure options (--configureoptions option for pecl install).
* Refer to update-submodule-sources.php in config.m4/w32 and fix macOS compatibility
* PHPC-2314: Require OpenSSL 1.0.1+ for libmongoc 1.24+
* PHPC-2315: Use PKG_CHECK_MODULES for detecting libmongoc system libs
* Remove superfluous AC_MSG_NOTICE output in CheckSSL.m4
* PHPC-2274: Apply libmongocrypt defs to PHP_MONGODB_LIBMONGOCRYPT_CFLAGS
This ensures PHP_MONGODB_LIBMONGOCRYPT_CFLAGS is used instead of PHP_MONGODB_BUNDLED_CFLAGS for libmongocrypt-specific checks.
A libmongoc-specific copy of Endian.m4 has been created to use when building without libmongocrypt, since the endianness check is still required by libmongoc's bundled KMS sources.
* PHPC-2308: Handle unknown and universal cases for AC_C_BIGENDIAN
* Do not call AC_PROG_CC_C99 on autoconf 2.70+
* Replace obsolete AC_TRY_COMPILE with AC_COMPILE_IFELSE
* Update pkg.m4 to pkg-config-0.29
* Update ax_check_compile_flag.m4
* Update ax_pthread.m4
* Update ax_prototype.m4 and introduce ax_prototype_accept.m4
This also moves the accept() checking to libmongoc/FindDependencies.m4, since it is specific to libmongoc.
* PHPC-2272: as_var_copy.m4 is obsolete
PHP 7.4 requires autoconf 2.68+ and AS_VAR_COPY was introduced in 2.64
Bumps the libmongoc submodule to mongodb/mongo-c-driver@d933a8c996, which is the 1.25-dev commit for the corresponding patch in the 1.24.3 release for PHPC's 1.16 branch.
* Update to libmongoc 1.24.3
* Define constants for POSIX features and extensions used by libmongoc 1.24
This removes old logic to not define _DEFAULT_SOURCE on Windows (technically MinGW or Cygwin). It's not clear whether that was ever necessary; it was introduced in ab44b0cbeb based on upstream work in mongodb/mongo-c-driver@9d2d8b157c, but libmongoc did not utilize the same logic.
In any event, these constants are now defined unconditionally for libmongoc since mongodb/mongo-c-driver@c5206511cd, so this change should restore parity between PHPC's autoconf and libmongoc's CMake configurations.
* Remove obsolete conditional defines for glibc 2.19
It's not clear what purpose this originally served. It dates back to mongodb/mongo-c-driver@50f701ce6a, but PHPC never incorporated the defines into its own CPPFLAGS.
The recent additions to PlatformFlags.m4 should be sufficient.
Bumps libmongoc to 1.25-dev.
This introduces a --with-mongodb-utf8proc configure flag, which accepts "bundled" (default) and "system". Windows will always use bundled sources.
CheckICU.m4 and the --with-mongodb-icu configure flag have been removed.
For the libmongoc bump, this also adds support for a new MONGOC_ENABLE_SRV config constant, which is currently set based on detection in CheckResolv.m4. We can consider exposing that as a configure option down the line in PHPC-2256.
* Add script to generate function map for static analysis tools
* Refactor function map generation script
* Remove workaround for unserialize methods
* Update list of phony make targets
* Add section about generating function maps to contribution docs
* Fix code style in function map generator
This introduces several configure options:
--with-mongodb-snappy=[auto/yes/no]
--with-mongodb-zlib=[auto/yes/system/bundled/no]
--with-mongodb-zstd=[auto/yes/no]
The "auto", "yes", and "no" options behave like existing options: "auto" attempts to use a library but allows it to not be found; "yes" requires a library and errors if it's not found; "no" disables a library.
The "system" and "bundled" options for zlib function like "yes", but for using the system library or bundled zlib sources in libmongoc, respectively. Since bundled sources are always available, configuring zlib with "auto", "yes", or "bundled" should never fail.
* Update expected error message for invalid crypt_shared override path
This was changed in mongodb/libmongocrypt@792beee312 for MONGOCRYPT-576
* Update update-submodule-sources script for zlib 1.2.13
libmongoc 1.24-dev recently bumped zlib from 1.2.12 to 1.2.13 (CDRIVER-4624). This change was applied to config.m4 in 14af5ea970 but that commit missed the update-submodule-sources script.
* Extract bson to json conversion logic
* PHPC-326: Add class to represent raw BSON document
* PHPC-326: Add class to represent raw BSON array
* Typemaps now support raw BSON type
* Short-circuit encoding of BSON zvals
* PHPC-324: Add BSONIterator class
* Polyfill zend_array_is_list on PHP < 8.1
* Add offset accessors to BSON classes
* Add more tests around iterators and fetching offsets
* Remove compare handler for BSONIterator
* Rename BSONArray to ArrayList
* Rename BSONDocument to Document
* Rename BSONIterator to Iterator
* Implement Document::fromBSONString
* Test BSON document in bson-corpus tests
* Fix ArrayList handling of BSON arrays with wrong keys
* Address code review for bson-corpus tests
* Address code review in ArrayList
* Address code review for Document
* Address code review for Iterator
* Allow BSON iterators to be rewound
* Address code review in tests
* Fix comment explaining php_phongo_bson_append_object
* Remove obsolete php_phongo_bson_append_zval
* More review changes to tests
* Return base64 encoded data when debugging BSON classes
* Allow serialisation of Document and ArrayList
* Add test for iterating past the end of a structure
* Update exception message to contain class name
* Make BSON pclass handling test more complete
* Fix wrong handling of type map in nested structures
* Ensure objects are backed by actual memory
* Validate UTF-8 BSON data before returning it
* Allow ArrayList::toPHP() to accept a different root type map
* Ignore null return type for invalid BSON iterators on PHP < 8
* Throw when calling get on non-existing BSON offsets
* Remove unnecessary length from serialised output
* Refactor names around type map handling
* Use short array syntax in new tests
* Improve test descriptions
* Restructure BSON iterator tests
* Expand BSON class serialisation tests
* Throw exception when iterator is exhausted
The previous method relied on the type system of PHP to throw an exception when accessing the key of an exhausted iterator, but this does not work on non-debug versions of PHP.
* Update test description
* Rename ArrayList class to PackedArray
v1.14 pointed to libmongoc 1.14.2, which was released some time after the submodule target in the master branch (a dev commit before libmongoc 1.23.0). To resolve this conflict, the libmongoc submodule has been bumped to 1.23.0.
Note: a libmongoc 1.23.1 tag also exists, but that bump can be done in a subsequent PHPC ticket related to the libmongoc changes therein.
This also adds a section to CONTRIBUTING.md to provide guidance on resolving submodule merge conflicts.
* Add missing macros for declaring arguments
* Add macros to define disabled constructor and __wakeup
* Define arginfo via stubs for BSON classes
* Declare tentative return types in interfaces
* Add correct return type for __set_state methods
* Generate class entries for BSON classes
* Declare Binary class constants in stub file
* Use stubs in exception classes
* Add stubs for monitoring classes
* Fix wrong JsonSerializable class in BSON stubs
* Disable declaration-after-statement
This is necessary to let the generated arginfo files compile
* Use stubs for driver classes
* Fix deprecation messages in tests
* Add missing macro
* Fix tests relying on value injection
* Parse parameters in disabled constructor/wakup function
* Add note about arginfo files to contribution docs
* Add GitHub action to check generated arginfo files
* PHPC-2115: Use DateTimeInterface in UTCDateTime constructor signature
* Don't install mongodb extension in GitHub actions workflows
* Change indentation in stub files
* Use individual #if conditions for each stub method
* Make disabled constructor/wakeup methods static
* Fix bulkWrite parameter name
* Use %d to match property count in tests
* Ensure all classes with disabled serialisation declare __wakeup
* PHPC-2049: Bump libmongoc and libmongocrypt submodules
libmongoc master (1.22-dev) now depends on libmongocrypt master (1.5-dev).
libmongoc's bundled zlib library was updated to 1.2.12.
* PHPC-2049: BulkWrite and Query support comment option of any type
MongoDB 4.4+ allows a comment option of any type on most commands. Previously, find required a string type and write commands did not support comment at all. The driver does not validate the option and relies on the server to raise an error.
* Fix title and variable access in BulkWrite and Query let option tests
* Fix grammar in php_phongo_bulkwrite_delete_apply_options comment
* Undefine additional Query option macros
This allows PHPC to defer entirely to libmongoc for cross-option URI validation
Bump libmongoc to 1.21-dev
Build changes are ported from upstream CMake changes (see: CDRIVER-4249)
* 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
* Add GitHub Action workflow for tests
* Add workflow to check formatting
* Remove travis-ci config
* Fix clang-format error
* Add shared json extension for tests
* Hide output for xfail tests
* Use mongo-orchestration configs from drivers-evergreen-tools
* Drop obsolete test scripts
This drops the legacy VM environment and remnants of the travis-ci config
* Remove obsolete server_id config
* Add note about MONGO_ORCHESTRATION_URI to contribution docs
* Restore previous XFAIL behaviour
This did not have the expected effect of preventing diff output for tests that expect failures, so it can be reverted.
* Make SSL certificate path configurable for tests
Since mongo-orchestration will always bring its own certificates, we need to set the correct SSL certificate directory for our tests. This is skipped on GitHub Actions as we don't test SSL builds there (yet). If SSL_DIR was not set, tests requiring SSL will be skipped.
* Fix code review nits
On AIX, the resolver functions are in libc, so trying libresolv
will cause the checks to fail. The behaviour should be instead
like AC_SEARCH_LIBS.
This hardcodes a check not to use libresolv on AIX. Better than
nothing, but it may not compensate for other systems without a
libresolv.
Syncs tests with mongodb/specifications@1713439515. Includes tests for PHPC-1655 and PHPC-1652.
Adds logic to canonicalize $numberDouble values, which allows previously skipped tests to pass. This was noticed because SPEC-1537 changed the description of these tests and they were no loner skipped by convert-bson-corpus-tests.php.
Per src/libmongoc/doc/installing.rst, the VERSION_CURRENT and VERSION_RELEASED files must now be generated. This requires Python and the GitPython pip module to run src/libmongoc/build/calc_release_version.py. A new libmongoc-version-current Makefile target has been added.