diff --git a/.evergreen/architecture.md b/.evergreen/architecture.md index 811dbc0bb..f02ab6182 100644 --- a/.evergreen/architecture.md +++ b/.evergreen/architecture.md @@ -15,8 +15,7 @@ initialisation. If a build step fails, test tasks are skipped for that platform Build tasks are generated automatically and included in the main config file. The `build-variants.yml` file contains the list of supported platforms that the extension is built for. `build-task-groups.yml` defines the task groups that -contain the build tasks. Note there is a separate task that skips PHP 7.4 and 8.0, as these versions do not support -OpenSSL 3 (currently used on RHEL 9+ and Ubuntu 22.04+). +contain the build tasks. ## Build Step 2: Run Tests diff --git a/.evergreen/config.yml b/.evergreen/config.yml index 4e4a696a5..1e226a5a8 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -74,6 +74,5 @@ include: - filename: .evergreen/config/generated/test/ocsp.yml - filename: .evergreen/config/generated/test/require-api-version.yml - filename: .evergreen/config/generated/test/skip-crypt-shared.yml - - filename: .evergreen/config/generated/test-variant/modern-php-full.yml - - filename: .evergreen/config/generated/test-variant/legacy-php-full.yml + - filename: .evergreen/config/generated/test-variant/php-full.yml - filename: .evergreen/config/generated/test-variant/libmongoc.yml diff --git a/.evergreen/config/build-task-groups.yml b/.evergreen/config/build-task-groups.yml index cf337cc24..8aebe38d7 100644 --- a/.evergreen/config/build-task-groups.yml +++ b/.evergreen/config/build-task-groups.yml @@ -11,7 +11,7 @@ task_groups: # Builds all versions of PHP - name: "build-all-php" # Keep this number in sync with the number of PHP versions to allow for parallel builds - max_hosts: 4 + max_hosts: 3 setup_task: *build_setup setup_task_can_fail_task: true setup_task_timeout_secs: 1800 @@ -19,18 +19,6 @@ task_groups: tasks: - ".build" - # Builds all versions of PHP that support OpenSSL 3 (PHP 8.1+) - - name: "build-php-openssl3" - # Keep this number in sync with the number of PHP versions to allow for parallel builds - # Subtract 2 versions as PHP 7.4 and 8.0 are not built with OpenSSL 3 - max_hosts: 2 - setup_task: *build_setup - setup_task_can_fail_task: true - setup_task_timeout_secs: 1800 - teardown_task: *build_teardown - tasks: - - ".build !.php7.4 !.php8.0" - - name: "build-php-libmongoc" # Keep this in sync with the actual number of libmongoc builds (typically 3) defined in _template-build-libmongoc.yml max_hosts: 3 diff --git a/.evergreen/config/build-variants.yml b/.evergreen/config/build-variants.yml index d6ac2e051..be04d255d 100644 --- a/.evergreen/config/build-variants.yml +++ b/.evergreen/config/build-variants.yml @@ -8,7 +8,7 @@ buildvariants: tags: ["build", "debian", "x64", "pr", "tag"] run_on: debian12-small tasks: - - name: "build-php-openssl3" + - name: "build-all-php" - name: "build-php-libmongoc" - name: build-debian11 display_name: "Build: Debian 11" @@ -35,7 +35,7 @@ buildvariants: tags: ["build", "rhel", "x64", "pr", "tag"] run_on: rhel90-small tasks: - - name: "build-php-openssl3" + - name: "build-all-php" - name: build-rhel83-zseries display_name: "Build: RHEL 8.3 Zseries" tags: ["build", "rhel", "zseries", "tag"] @@ -73,13 +73,13 @@ buildvariants: tags: ["build", "ubuntu", "x64", "pr", "tag"] run_on: ubuntu2204-small tasks: - - name: "build-php-openssl3" + - name: "build-all-php" - name: build-ubuntu2204-arm64 display_name: "Build: Ubuntu 22.04 ARM64" tags: ["build", "ubuntu", "arm64", "tag"] run_on: ubuntu2204-arm64-small tasks: - - name: "build-php-openssl3" + - name: "build-all-php" - name: build-ubuntu2004 display_name: "Build: Ubuntu 20.04 x64" tags: ["build", "ubuntu", "x64", "tag"] diff --git a/.evergreen/config/generate-config.php b/.evergreen/config/generate-config.php index b6d999c58..973f0981a 100644 --- a/.evergreen/config/generate-config.php +++ b/.evergreen/config/generate-config.php @@ -2,16 +2,11 @@ = 5.0, < 8.0 - - name: test-debian11-php-8.0 - tags: ["test", "debian", "x64", "php8.0", "pr", "tag"] - display_name: "Test: Debian 11, PHP 8.0" - run_on: debian11-small - expansions: - FETCH_BUILD_VARIANT: "build-debian11" - FETCH_BUILD_TASK: "build-php-8.0" - depends_on: - - variant: "build-debian11" - name: "build-php-8.0" - tasks: - # Remember to add new major versions here as they are released - - ".standalone .local !.4.0 !.4.2 !.4.4 !.8.0" - - ".replicaset .local !.4.0 !.4.2 !.4.4 !.8.0" - - ".sharded .local !.4.0 !.4.2 !.4.4 !.8.0" - - ".loadbalanced .local !.4.0 !.4.2 !.4.4 !.8.0" - - ".ocsp !.4.4 !.8.0" - - "test-atlas-connectivity" - display_tasks: - - name: "test-ocsp-latest" - execution_tasks: - - ".ocsp .latest" - - name: "test-ocsp-rapid" - execution_tasks: - - ".ocsp .rapid" - - name: "test-ocsp-7.0" - execution_tasks: - - ".ocsp .7.0" - - name: "test-ocsp-6.0" - execution_tasks: - - ".ocsp .6.0" - - name: "test-ocsp-5.0" - execution_tasks: - - ".ocsp .5.0" - - # Test versions < 5.0 - - name: test-debian92-php-8.0 - tags: ["test", "debian", "x64", "php8.0", "pr", "tag"] - display_name: "Test: Debian 9.2, PHP 8.0" - run_on: debian92-small - expansions: - FETCH_BUILD_VARIANT: "build-debian92" - FETCH_BUILD_TASK: "build-php-8.0" - depends_on: - - variant: "build-debian92" - name: "build-php-8.0" - tasks: - # Remember to add new major versions here as they are released - - ".standalone .local !.5.0 !.6.0 !.7.0 !.8.0 !.rapid !.latest" - - ".replicaset .local !.5.0 !.6.0 !.7.0 !.8.0 !.rapid !.latest" - - ".sharded .local !.5.0 !.6.0 !.7.0 !.8.0 !.rapid !.latest" - - ".loadbalanced .local !.5.0 !.6.0 !.7.0 !.8.0 !.rapid !.latest" - - ".ocsp !.5.0 !.6.0 !.7.0 !.8.0 !.rapid !.latest" - display_tasks: - - name: "test-ocsp-4.4" - execution_tasks: - - ".ocsp .4.4" - # TODO PHPC-2343: This file can be removed when requiring PHP 8.1+ - # Test MongoDB >= 5.0, < 8.0 - - name: test-debian11-php-7.4 - tags: ["test", "debian", "x64", "php7.4", "pr", "tag"] - display_name: "Test: Debian 11, PHP 7.4" - run_on: debian11-small - expansions: - FETCH_BUILD_VARIANT: "build-debian11" - FETCH_BUILD_TASK: "build-php-7.4" - depends_on: - - variant: "build-debian11" - name: "build-php-7.4" - tasks: - # Remember to add new major versions here as they are released - - ".standalone .local !.4.0 !.4.2 !.4.4 !.8.0" - - ".replicaset .local !.4.0 !.4.2 !.4.4 !.8.0" - - ".sharded .local !.4.0 !.4.2 !.4.4 !.8.0" - - ".loadbalanced .local !.4.0 !.4.2 !.4.4 !.8.0" - - ".ocsp !.4.4 !.8.0" - - "test-atlas-connectivity" - display_tasks: - - name: "test-ocsp-latest" - execution_tasks: - - ".ocsp .latest" - - name: "test-ocsp-rapid" - execution_tasks: - - ".ocsp .rapid" - - name: "test-ocsp-7.0" - execution_tasks: - - ".ocsp .7.0" - - name: "test-ocsp-6.0" - execution_tasks: - - ".ocsp .6.0" - - name: "test-ocsp-5.0" - execution_tasks: - - ".ocsp .5.0" - - # Test versions < 5.0 - - name: test-debian92-php-7.4 - tags: ["test", "debian", "x64", "php7.4", "pr", "tag"] - display_name: "Test: Debian 9.2, PHP 7.4" - run_on: debian92-small - expansions: - FETCH_BUILD_VARIANT: "build-debian92" - FETCH_BUILD_TASK: "build-php-7.4" - depends_on: - - variant: "build-debian92" - name: "build-php-7.4" - tasks: - # Remember to add new major versions here as they are released - - ".standalone .local !.5.0 !.6.0 !.7.0 !.8.0 !.rapid !.latest" - - ".replicaset .local !.5.0 !.6.0 !.7.0 !.8.0 !.rapid !.latest" - - ".sharded .local !.5.0 !.6.0 !.7.0 !.8.0 !.rapid !.latest" - - ".loadbalanced .local !.5.0 !.6.0 !.7.0 !.8.0 !.rapid !.latest" - - ".ocsp !.5.0 !.6.0 !.7.0 !.8.0 !.rapid !.latest" - display_tasks: - - name: "test-ocsp-4.4" - execution_tasks: - - ".ocsp .4.4" diff --git a/.evergreen/config/generated/test-variant/modern-php-full.yml b/.evergreen/config/generated/test-variant/php-full.yml similarity index 99% rename from .evergreen/config/generated/test-variant/modern-php-full.yml rename to .evergreen/config/generated/test-variant/php-full.yml index 8ee3d8be1..511d72887 100644 --- a/.evergreen/config/generated/test-variant/modern-php-full.yml +++ b/.evergreen/config/generated/test-variant/php-full.yml @@ -1,4 +1,4 @@ -# This file is generated automatically - please edit the "templates/test-variant/modern-php-full.yml" template file instead. +# This file is generated automatically - please edit the "templates/test-variant/php-full.yml" template file instead. buildvariants: # Test MongoDB >= 7.0 - name: test-debian12-php-8.3 diff --git a/.evergreen/config/templates/test-variant/legacy-php-full.yml b/.evergreen/config/templates/test-variant/legacy-php-full.yml deleted file mode 100644 index 4fa23f7db..000000000 --- a/.evergreen/config/templates/test-variant/legacy-php-full.yml +++ /dev/null @@ -1,59 +0,0 @@ - # TODO PHPC-2343: This file can be removed when requiring PHP 8.1+ - # Test MongoDB >= 5.0, < 8.0 - - name: test-debian11-php-%phpVersion% - tags: ["test", "debian", "x64", "php%phpVersion%", "pr", "tag"] - display_name: "Test: Debian 11, PHP %phpVersion%" - run_on: debian11-small - expansions: - FETCH_BUILD_VARIANT: "build-debian11" - FETCH_BUILD_TASK: "build-php-%phpVersion%" - depends_on: - - variant: "build-debian11" - name: "build-php-%phpVersion%" - tasks: - # Remember to add new major versions here as they are released - - ".standalone .local !.4.0 !.4.2 !.4.4 !.8.0" - - ".replicaset .local !.4.0 !.4.2 !.4.4 !.8.0" - - ".sharded .local !.4.0 !.4.2 !.4.4 !.8.0" - - ".loadbalanced .local !.4.0 !.4.2 !.4.4 !.8.0" - - ".ocsp !.4.4 !.8.0" - - "test-atlas-connectivity" - display_tasks: - - name: "test-ocsp-latest" - execution_tasks: - - ".ocsp .latest" - - name: "test-ocsp-rapid" - execution_tasks: - - ".ocsp .rapid" - - name: "test-ocsp-7.0" - execution_tasks: - - ".ocsp .7.0" - - name: "test-ocsp-6.0" - execution_tasks: - - ".ocsp .6.0" - - name: "test-ocsp-5.0" - execution_tasks: - - ".ocsp .5.0" - - # Test versions < 5.0 - - name: test-debian92-php-%phpVersion% - tags: ["test", "debian", "x64", "php%phpVersion%", "pr", "tag"] - display_name: "Test: Debian 9.2, PHP %phpVersion%" - run_on: debian92-small - expansions: - FETCH_BUILD_VARIANT: "build-debian92" - FETCH_BUILD_TASK: "build-php-%phpVersion%" - depends_on: - - variant: "build-debian92" - name: "build-php-%phpVersion%" - tasks: - # Remember to add new major versions here as they are released - - ".standalone .local !.5.0 !.6.0 !.7.0 !.8.0 !.rapid !.latest" - - ".replicaset .local !.5.0 !.6.0 !.7.0 !.8.0 !.rapid !.latest" - - ".sharded .local !.5.0 !.6.0 !.7.0 !.8.0 !.rapid !.latest" - - ".loadbalanced .local !.5.0 !.6.0 !.7.0 !.8.0 !.rapid !.latest" - - ".ocsp !.5.0 !.6.0 !.7.0 !.8.0 !.rapid !.latest" - display_tasks: - - name: "test-ocsp-4.4" - execution_tasks: - - ".ocsp .4.4" diff --git a/.evergreen/config/templates/test-variant/modern-php-full.yml b/.evergreen/config/templates/test-variant/php-full.yml similarity index 100% rename from .evergreen/config/templates/test-variant/modern-php-full.yml rename to .evergreen/config/templates/test-variant/php-full.yml diff --git a/.github/actions/windows/prepare-build/action.yml b/.github/actions/windows/prepare-build/action.yml index 1ef49a17c..b48b89e08 100644 --- a/.github/actions/windows/prepare-build/action.yml +++ b/.github/actions/windows/prepare-build/action.yml @@ -17,18 +17,6 @@ outputs: runs: using: composite steps: - # Reinstall VC15 (Visual Studio 2017) for PHP 7.4 using a derivation of the - # script suggested in https://github.com/actions/runner-images/issues/9701 - - name: Install VC15 component for PHP 7.4 - if: ${{ inputs.version == '7.4' }} - shell: pwsh - run: | - Set-Location "C:\Program Files (x86)\Microsoft Visual Studio\Installer\" - $installPath = "C:\Program Files\Microsoft Visual Studio\2022\Enterprise" - $component = "Microsoft.VisualStudio.Component.VC.v141.x86.x64" - $args = ('/c', "vs_installer.exe", 'modify', '--installPath', "`"$installPath`"", '--add', $component, '--quiet', '--norestart', '--nocache') - $process = Start-Process -FilePath cmd.exe -ArgumentList $args -Wait -PassThru -WindowStyle Hidden - - name: Setup PHP SDK id: setup-php uses: php/setup-php-sdk@v0.9 diff --git a/.github/workflows/clang-format.yml b/.github/workflows/clang-format.yml index 02efe992e..33ced1606 100644 --- a/.github/workflows/clang-format.yml +++ b/.github/workflows/clang-format.yml @@ -13,7 +13,7 @@ on: - "feature/*" env: - PHP_VERSION: "7.4" + PHP_VERSION: "8.1" jobs: coding-standards: diff --git a/.github/workflows/package-release.yml b/.github/workflows/package-release.yml index b1c67a2ae..b9e91915c 100644 --- a/.github/workflows/package-release.yml +++ b/.github/workflows/package-release.yml @@ -98,6 +98,6 @@ jobs: fail-fast: false matrix: # Note: keep this in sync with the Windows matrix in tests.yml - php: [ "7.4", "8.0", "8.1", "8.2", "8.3", "8.4" ] + php: [ "8.1", "8.2", "8.3", "8.4" ] arch: [ x64, x86 ] ts: [ ts, nts ] diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 654d40c91..bd2c770a1 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -23,8 +23,6 @@ jobs: os: - "ubuntu-20.04" php-version: - - "7.4" - - "8.0" - "8.1" - "8.2" - "8.3" @@ -35,19 +33,19 @@ jobs: - "server" include: - os: "ubuntu-20.04" - php-version: "8.0" + php-version: "8.1" mongodb-version: "6.0" topology: "replica_set" - os: "ubuntu-20.04" - php-version: "8.0" + php-version: "8.1" mongodb-version: "6.0" topology: "sharded_cluster" - os: "ubuntu-20.04" - php-version: "8.0" + php-version: "8.1" mongodb-version: "4.4" topology: "replica_set" - os: "ubuntu-20.04" - php-version: "8.0" + php-version: "8.1" mongodb-version: "4.4" topology: "sharded_cluster" @@ -124,6 +122,6 @@ jobs: fail-fast: false matrix: # Note: keep this in sync with the Windows matrix in package-release.yml - php: [ "7.4", "8.0", "8.1", "8.2", "8.3", "8.4" ] + php: [ "8.1", "8.2", "8.3", "8.4" ] arch: [ x64, x86 ] ts: [ ts, nts ] diff --git a/bin/package.xml.in b/bin/package.xml.in index 87afd2a01..16b91b283 100644 --- a/bin/package.xml.in +++ b/bin/package.xml.in @@ -58,7 +58,7 @@ necessary to build a fully-functional MongoDB driver. - 7.4.0 + 8.1.0 8.99.99 diff --git a/config.m4 b/config.m4 index 28e8ddae6..6c9d5a238 100644 --- a/config.m4 +++ b/config.m4 @@ -38,8 +38,8 @@ if test "$PHP_MONGODB" != "no"; then AC_MSG_RESULT($PHP_MONGODB_PHP_VERSION) - if test "$PHP_MONGODB_PHP_VERSION_ID" -lt "70400"; then - AC_MSG_ERROR([not supported. Need a PHP version >= 7.4.0 (found $PHP_MONGODB_PHP_VERSION)]) + if test "$PHP_MONGODB_PHP_VERSION_ID" -lt "80100"; then + AC_MSG_ERROR([not supported. Need a PHP version >= 8.1.0 (found $PHP_MONGODB_PHP_VERSION)]) fi PHP_MONGODB_STD_CFLAGS="" diff --git a/config.w32 b/config.w32 index db80390f8..bb45d134c 100644 --- a/config.w32 +++ b/config.w32 @@ -74,17 +74,8 @@ ARG_WITH("mongodb-sasl", "MongoDB: Build against Cyrus-SASL", "yes"); ARG_WITH("mongodb-client-side-encryption", "MongoDB: Enable client-side encryption", "yes"); if (PHP_MONGODB != "no") { - /* Note: ADD_EXTENSION_DEP() only reports the date and standard extensions as - * installed in PHP 7.4.13+ and 8.0.0+). On other versions, assume that - * they're always enabled. */ - if ( - PHP_VERSION >= 8 || - (PHP_VERSION == 7 && PHP_MINOR_VERSION == 4 && PHP_RELEASE_VERSION >= 13) - ) { - ADD_EXTENSION_DEP("mongodb", "date", false); - ADD_EXTENSION_DEP("mongodb", "standard", false); - } - + ADD_EXTENSION_DEP("mongodb", "date", false); + ADD_EXTENSION_DEP("mongodb", "standard", false); ADD_EXTENSION_DEP("mongodb", "json", false); ADD_EXTENSION_DEP("mongodb", "spl", false); diff --git a/php_phongo.c b/php_phongo.c index 516039327..e44eb3b19 100644 --- a/php_phongo.c +++ b/php_phongo.c @@ -154,7 +154,7 @@ static zend_class_entry* php_phongo_fetch_internal_class(const char* class_name, return NULL; } -static HashTable* php_phongo_std_get_gc(phongo_compat_object_handler_type* object, zval** table, int* n) +static HashTable* php_phongo_std_get_gc(zend_object* object, zval** table, int* n) { *table = NULL; *n = 0; diff --git a/php_phongo.h b/php_phongo.h index 32bdc9602..4a4b01dea 100644 --- a/php_phongo.h +++ b/php_phongo.h @@ -60,24 +60,6 @@ ZEND_TSRMLS_CACHE_EXTERN() zend_object_handlers* phongo_get_std_object_handlers(void); -#define PHONGO_CE_FINAL(ce) \ - do { \ - ce->ce_flags |= ZEND_ACC_FINAL; \ - } while (0) - -#if PHP_VERSION_ID < 80100 -#define PHONGO_CE_DISABLE_SERIALIZATION(ce) \ - do { \ - ce->serialize = zend_class_serialize_deny; \ - ce->unserialize = zend_class_unserialize_deny; \ - } while (0) -#else -#define PHONGO_CE_DISABLE_SERIALIZATION(ce) \ - do { \ - ce->ce_flags |= ZEND_ACC_NOT_SERIALIZABLE; \ - } while (0) -#endif - #define PHONGO_GET_PROPERTY_HASH_INIT_PROPS(is_temp, intern, props, size) \ do { \ if (is_temp) { \ diff --git a/src/BSON/Binary.c b/src/BSON/Binary.c index a29ab69e2..7560e30dd 100644 --- a/src/BSON/Binary.c +++ b/src/BSON/Binary.c @@ -65,12 +65,12 @@ static bool php_phongo_binary_init_from_hash(php_phongo_binary_t* intern, HashTa return false; } -static HashTable* php_phongo_binary_get_properties_hash(phongo_compat_object_handler_type* object, bool is_temp) +static HashTable* php_phongo_binary_get_properties_hash(zend_object* object, bool is_temp) { php_phongo_binary_t* intern; HashTable* props; - intern = Z_OBJ_BINARY(PHONGO_COMPAT_GET_OBJ(object)); + intern = Z_OBJ_BINARY(object); PHONGO_GET_PROPERTY_HASH_INIT_PROPS(is_temp, intern, props, 2); @@ -242,7 +242,7 @@ static PHP_METHOD(MongoDB_BSON_Binary, __serialize) { PHONGO_PARSE_PARAMETERS_NONE(); - RETURN_ARR(php_phongo_binary_get_properties_hash(PHONGO_COMPAT_OBJ_P(getThis()), true)); + RETURN_ARR(php_phongo_binary_get_properties_hash(Z_OBJ_P(getThis()), true)); } static PHP_METHOD(MongoDB_BSON_Binary, __unserialize) @@ -287,14 +287,14 @@ static zend_object* php_phongo_binary_create_object(zend_class_entry* class_type return &intern->std; } -static zend_object* php_phongo_binary_clone_object(phongo_compat_object_handler_type* object) +static zend_object* php_phongo_binary_clone_object(zend_object* object) { php_phongo_binary_t* intern; php_phongo_binary_t* new_intern; zend_object* new_object; - intern = Z_OBJ_BINARY(PHONGO_COMPAT_GET_OBJ(object)); - new_object = php_phongo_binary_create_object(PHONGO_COMPAT_GET_OBJ(object)->ce); + intern = Z_OBJ_BINARY(object); + new_object = php_phongo_binary_create_object(object->ce); new_intern = Z_OBJ_BINARY(new_object); zend_objects_clone_members(&new_intern->std, &intern->std); @@ -326,28 +326,24 @@ static int php_phongo_binary_compare_objects(zval* o1, zval* o2) return zend_binary_strcmp(intern1->data, intern1->data_len, intern2->data, intern2->data_len); } -static HashTable* php_phongo_binary_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) +static HashTable* php_phongo_binary_get_debug_info(zend_object* object, int* is_temp) { *is_temp = 1; return php_phongo_binary_get_properties_hash(object, true); } -static HashTable* php_phongo_binary_get_properties(phongo_compat_object_handler_type* object) +static HashTable* php_phongo_binary_get_properties(zend_object* object) { return php_phongo_binary_get_properties_hash(object, false); } void php_phongo_binary_init_ce(INIT_FUNC_ARGS) { - php_phongo_binary_ce = register_class_MongoDB_BSON_Binary(php_phongo_binary_interface_ce, php_phongo_json_serializable_ce, php_phongo_type_ce, zend_ce_serializable); + php_phongo_binary_ce = register_class_MongoDB_BSON_Binary(php_phongo_binary_interface_ce, php_phongo_json_serializable_ce, php_phongo_type_ce, zend_ce_serializable, zend_ce_stringable); php_phongo_binary_ce->create_object = php_phongo_binary_create_object; -#if PHP_VERSION_ID >= 80000 - zend_class_implements(php_phongo_binary_ce, 1, zend_ce_stringable); -#endif - memcpy(&php_phongo_handler_binary, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); - PHONGO_COMPAT_SET_COMPARE_OBJECTS_HANDLER(binary); + php_phongo_handler_binary.compare = php_phongo_binary_compare_objects; php_phongo_handler_binary.clone_obj = php_phongo_binary_clone_object; php_phongo_handler_binary.get_debug_info = php_phongo_binary_get_debug_info; php_phongo_handler_binary.get_properties = php_phongo_binary_get_properties; diff --git a/src/BSON/Binary.stub.php b/src/BSON/Binary.stub.php index 128082ac6..a56fbfa42 100644 --- a/src/BSON/Binary.stub.php +++ b/src/BSON/Binary.stub.php @@ -7,7 +7,7 @@ namespace MongoDB\BSON; -final class Binary implements BinaryInterface, \JsonSerializable, Type, \Serializable +final class Binary implements BinaryInterface, \JsonSerializable, Type, \Serializable, \Stringable { /** * @var int @@ -81,21 +81,11 @@ final public function __toString(): string {} final public function serialize(): string {} -#if PHP_VERSION_ID >= 80000 final public function unserialize(string $data): void {} -#else - /** @param string $serialized */ - final public function unserialize($serialized): void {} -#endif final public function __unserialize(array $data): void {} final public function __serialize(): array {} -#if PHP_VERSION_ID >= 80000 final public function jsonSerialize(): mixed {} -#else - /** @return mixed */ - final public function jsonSerialize() {} -#endif } diff --git a/src/BSON/Binary_arginfo.h b/src/BSON/Binary_arginfo.h index 66a626238..d62674965 100644 --- a/src/BSON/Binary_arginfo.h +++ b/src/BSON/Binary_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 5119314f018eb048882d59bd952648336a8aa5d2 */ + * Stub hash: 5b480f539df83a112ecaecc234364272d9209257 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Binary___construct, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0) @@ -20,17 +20,9 @@ ZEND_END_ARG_INFO() #define arginfo_class_MongoDB_BSON_Binary_serialize arginfo_class_MongoDB_BSON_Binary_getData -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Binary_unserialize, 0, 1, IS_VOID, 0) ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0) ZEND_END_ARG_INFO() -#endif - -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Binary_unserialize, 0, 1, IS_VOID, 0) - ZEND_ARG_INFO(0, serialized) -ZEND_END_ARG_INFO() -#endif ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Binary___unserialize, 0, 1, IS_VOID, 0) ZEND_ARG_TYPE_INFO(0, data, IS_ARRAY, 0) @@ -39,15 +31,8 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Binary___serialize, 0, 0, IS_ARRAY, 0) ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Binary_jsonSerialize, 0, 0, IS_MIXED, 0) ZEND_END_ARG_INFO() -#endif - -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Binary_jsonSerialize, 0, 0, 0) -ZEND_END_ARG_INFO() -#endif static ZEND_METHOD(MongoDB_BSON_Binary, __construct); @@ -56,20 +41,10 @@ static ZEND_METHOD(MongoDB_BSON_Binary, getType); static ZEND_METHOD(MongoDB_BSON_Binary, __set_state); static ZEND_METHOD(MongoDB_BSON_Binary, __toString); static ZEND_METHOD(MongoDB_BSON_Binary, serialize); -#if PHP_VERSION_ID >= 80000 static ZEND_METHOD(MongoDB_BSON_Binary, unserialize); -#endif -#if !(PHP_VERSION_ID >= 80000) -static ZEND_METHOD(MongoDB_BSON_Binary, unserialize); -#endif static ZEND_METHOD(MongoDB_BSON_Binary, __unserialize); static ZEND_METHOD(MongoDB_BSON_Binary, __serialize); -#if PHP_VERSION_ID >= 80000 -static ZEND_METHOD(MongoDB_BSON_Binary, jsonSerialize); -#endif -#if !(PHP_VERSION_ID >= 80000) static ZEND_METHOD(MongoDB_BSON_Binary, jsonSerialize); -#endif static const zend_function_entry class_MongoDB_BSON_Binary_methods[] = { @@ -79,31 +54,21 @@ static const zend_function_entry class_MongoDB_BSON_Binary_methods[] = { ZEND_ME(MongoDB_BSON_Binary, __set_state, arginfo_class_MongoDB_BSON_Binary___set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_BSON_Binary, __toString, arginfo_class_MongoDB_BSON_Binary___toString, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_BSON_Binary, serialize, arginfo_class_MongoDB_BSON_Binary_serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#if PHP_VERSION_ID >= 80000 ZEND_ME(MongoDB_BSON_Binary, unserialize, arginfo_class_MongoDB_BSON_Binary_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if !(PHP_VERSION_ID >= 80000) - ZEND_ME(MongoDB_BSON_Binary, unserialize, arginfo_class_MongoDB_BSON_Binary_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif ZEND_ME(MongoDB_BSON_Binary, __unserialize, arginfo_class_MongoDB_BSON_Binary___unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_BSON_Binary, __serialize, arginfo_class_MongoDB_BSON_Binary___serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#if PHP_VERSION_ID >= 80000 - ZEND_ME(MongoDB_BSON_Binary, jsonSerialize, arginfo_class_MongoDB_BSON_Binary_jsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if !(PHP_VERSION_ID >= 80000) ZEND_ME(MongoDB_BSON_Binary, jsonSerialize, arginfo_class_MongoDB_BSON_Binary_jsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif ZEND_FE_END }; -static zend_class_entry *register_class_MongoDB_BSON_Binary(zend_class_entry *class_entry_MongoDB_BSON_BinaryInterface, zend_class_entry *class_entry_JsonSerializable, zend_class_entry *class_entry_MongoDB_BSON_Type, zend_class_entry *class_entry_Serializable) +static zend_class_entry *register_class_MongoDB_BSON_Binary(zend_class_entry *class_entry_MongoDB_BSON_BinaryInterface, zend_class_entry *class_entry_JsonSerializable, zend_class_entry *class_entry_MongoDB_BSON_Type, zend_class_entry *class_entry_Serializable, zend_class_entry *class_entry_Stringable) { zend_class_entry ce, *class_entry; INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Binary", class_MongoDB_BSON_Binary_methods); class_entry = zend_register_internal_class_ex(&ce, NULL); class_entry->ce_flags |= ZEND_ACC_FINAL; - zend_class_implements(class_entry, 4, class_entry_MongoDB_BSON_BinaryInterface, class_entry_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable); + zend_class_implements(class_entry, 5, class_entry_MongoDB_BSON_BinaryInterface, class_entry_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable, class_entry_Stringable); zval const_TYPE_GENERIC_value; ZVAL_LONG(&const_TYPE_GENERIC_value, BSON_SUBTYPE_BINARY); diff --git a/src/BSON/DBPointer.c b/src/BSON/DBPointer.c index 91fa726e0..226abc4e5 100644 --- a/src/BSON/DBPointer.c +++ b/src/BSON/DBPointer.c @@ -66,12 +66,12 @@ static bool php_phongo_dbpointer_init_from_hash(php_phongo_dbpointer_t* intern, return false; } -HashTable* php_phongo_dbpointer_get_properties_hash(phongo_compat_object_handler_type* object, bool is_temp) +HashTable* php_phongo_dbpointer_get_properties_hash(zend_object* object, bool is_temp) { php_phongo_dbpointer_t* intern; HashTable* props; - intern = Z_OBJ_DBPOINTER(PHONGO_COMPAT_GET_OBJ(object)); + intern = Z_OBJ_DBPOINTER(object); PHONGO_GET_PROPERTY_HASH_INIT_PROPS(is_temp, intern, props, 2); @@ -205,7 +205,7 @@ static PHP_METHOD(MongoDB_BSON_DBPointer, __serialize) { PHONGO_PARSE_PARAMETERS_NONE(); - RETURN_ARR(php_phongo_dbpointer_get_properties_hash(PHONGO_COMPAT_OBJ_P(getThis()), true)); + RETURN_ARR(php_phongo_dbpointer_get_properties_hash(Z_OBJ_P(getThis()), true)); } static PHP_METHOD(MongoDB_BSON_DBPointer, __unserialize) @@ -250,14 +250,14 @@ zend_object* php_phongo_dbpointer_create_object(zend_class_entry* class_type) return &intern->std; } -static zend_object* php_phongo_dbpointer_clone_object(phongo_compat_object_handler_type* object) +static zend_object* php_phongo_dbpointer_clone_object(zend_object* object) { php_phongo_dbpointer_t* intern; php_phongo_dbpointer_t* new_intern; zend_object* new_object; - intern = Z_OBJ_DBPOINTER(PHONGO_COMPAT_GET_OBJ(object)); - new_object = php_phongo_dbpointer_create_object(PHONGO_COMPAT_GET_OBJ(object)->ce); + intern = Z_OBJ_DBPOINTER(object); + new_object = php_phongo_dbpointer_create_object(object->ce); new_intern = Z_OBJ_DBPOINTER(new_object); zend_objects_clone_members(&new_intern->std, &intern->std); @@ -286,28 +286,24 @@ static int php_phongo_dbpointer_compare_objects(zval* o1, zval* o2) return strcmp(intern1->id, intern2->id); } -static HashTable* php_phongo_dbpointer_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) +static HashTable* php_phongo_dbpointer_get_debug_info(zend_object* object, int* is_temp) { *is_temp = 1; return php_phongo_dbpointer_get_properties_hash(object, true); } -static HashTable* php_phongo_dbpointer_get_properties(phongo_compat_object_handler_type* object) +static HashTable* php_phongo_dbpointer_get_properties(zend_object* object) { return php_phongo_dbpointer_get_properties_hash(object, false); } void php_phongo_dbpointer_init_ce(INIT_FUNC_ARGS) { - php_phongo_dbpointer_ce = register_class_MongoDB_BSON_DBPointer(php_phongo_json_serializable_ce, php_phongo_type_ce, zend_ce_serializable); + php_phongo_dbpointer_ce = register_class_MongoDB_BSON_DBPointer(php_phongo_json_serializable_ce, php_phongo_type_ce, zend_ce_serializable, zend_ce_stringable); php_phongo_dbpointer_ce->create_object = php_phongo_dbpointer_create_object; -#if PHP_VERSION_ID >= 80000 - zend_class_implements(php_phongo_dbpointer_ce, 1, zend_ce_stringable); -#endif - memcpy(&php_phongo_handler_dbpointer, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); - PHONGO_COMPAT_SET_COMPARE_OBJECTS_HANDLER(dbpointer); + php_phongo_handler_dbpointer.compare = php_phongo_dbpointer_compare_objects; php_phongo_handler_dbpointer.clone_obj = php_phongo_dbpointer_clone_object; php_phongo_handler_dbpointer.get_debug_info = php_phongo_dbpointer_get_debug_info; php_phongo_handler_dbpointer.get_properties = php_phongo_dbpointer_get_properties; diff --git a/src/BSON/DBPointer.stub.php b/src/BSON/DBPointer.stub.php index b2e024cf0..e88a64805 100644 --- a/src/BSON/DBPointer.stub.php +++ b/src/BSON/DBPointer.stub.php @@ -6,7 +6,7 @@ */ namespace MongoDB\BSON; -final class DBPointer implements \JsonSerializable, Type, \Serializable +final class DBPointer implements \JsonSerializable, Type, \Serializable, \Stringable { final private function __construct() {} @@ -16,21 +16,11 @@ final public function __toString(): string {} final public function serialize(): string {} -#if PHP_VERSION_ID >= 80000 final public function unserialize(string $data): void {} -#else - /** @param string $serialized */ - final public function unserialize($serialized): void {} -#endif final public function __unserialize(array $data): void {} final public function __serialize(): array {} -#if PHP_VERSION_ID >= 80000 final public function jsonSerialize(): mixed {} -#else - /** @return mixed */ - final public function jsonSerialize() {} -#endif } diff --git a/src/BSON/DBPointer_arginfo.h b/src/BSON/DBPointer_arginfo.h index 0f9ba8a87..e790aed3b 100644 --- a/src/BSON/DBPointer_arginfo.h +++ b/src/BSON/DBPointer_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 6470b07511dad346b124a9ab7c3dbe9f67140a23 */ + * Stub hash: 0fd301b8c3e14f219023edc4d3137304f2bea022 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_DBPointer___construct, 0, 0, 0) ZEND_END_ARG_INFO() @@ -13,17 +13,9 @@ ZEND_END_ARG_INFO() #define arginfo_class_MongoDB_BSON_DBPointer_serialize arginfo_class_MongoDB_BSON_DBPointer___toString -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_DBPointer_unserialize, 0, 1, IS_VOID, 0) ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0) ZEND_END_ARG_INFO() -#endif - -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_DBPointer_unserialize, 0, 1, IS_VOID, 0) - ZEND_ARG_INFO(0, serialized) -ZEND_END_ARG_INFO() -#endif ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_DBPointer___unserialize, 0, 1, IS_VOID, 0) ZEND_ARG_TYPE_INFO(0, data, IS_ARRAY, 0) @@ -32,35 +24,18 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_DBPointer___serialize, 0, 0, IS_ARRAY, 0) ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_DBPointer_jsonSerialize, 0, 0, IS_MIXED, 0) ZEND_END_ARG_INFO() -#endif - -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_DBPointer_jsonSerialize, 0, 0, 0) -ZEND_END_ARG_INFO() -#endif static ZEND_METHOD(MongoDB_BSON_DBPointer, __construct); static ZEND_METHOD(MongoDB_BSON_DBPointer, __set_state); static ZEND_METHOD(MongoDB_BSON_DBPointer, __toString); static ZEND_METHOD(MongoDB_BSON_DBPointer, serialize); -#if PHP_VERSION_ID >= 80000 static ZEND_METHOD(MongoDB_BSON_DBPointer, unserialize); -#endif -#if !(PHP_VERSION_ID >= 80000) -static ZEND_METHOD(MongoDB_BSON_DBPointer, unserialize); -#endif static ZEND_METHOD(MongoDB_BSON_DBPointer, __unserialize); static ZEND_METHOD(MongoDB_BSON_DBPointer, __serialize); -#if PHP_VERSION_ID >= 80000 -static ZEND_METHOD(MongoDB_BSON_DBPointer, jsonSerialize); -#endif -#if !(PHP_VERSION_ID >= 80000) static ZEND_METHOD(MongoDB_BSON_DBPointer, jsonSerialize); -#endif static const zend_function_entry class_MongoDB_BSON_DBPointer_methods[] = { @@ -68,31 +43,21 @@ static const zend_function_entry class_MongoDB_BSON_DBPointer_methods[] = { ZEND_ME(MongoDB_BSON_DBPointer, __set_state, arginfo_class_MongoDB_BSON_DBPointer___set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_BSON_DBPointer, __toString, arginfo_class_MongoDB_BSON_DBPointer___toString, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_BSON_DBPointer, serialize, arginfo_class_MongoDB_BSON_DBPointer_serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#if PHP_VERSION_ID >= 80000 ZEND_ME(MongoDB_BSON_DBPointer, unserialize, arginfo_class_MongoDB_BSON_DBPointer_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if !(PHP_VERSION_ID >= 80000) - ZEND_ME(MongoDB_BSON_DBPointer, unserialize, arginfo_class_MongoDB_BSON_DBPointer_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif ZEND_ME(MongoDB_BSON_DBPointer, __unserialize, arginfo_class_MongoDB_BSON_DBPointer___unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_BSON_DBPointer, __serialize, arginfo_class_MongoDB_BSON_DBPointer___serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#if PHP_VERSION_ID >= 80000 - ZEND_ME(MongoDB_BSON_DBPointer, jsonSerialize, arginfo_class_MongoDB_BSON_DBPointer_jsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if !(PHP_VERSION_ID >= 80000) ZEND_ME(MongoDB_BSON_DBPointer, jsonSerialize, arginfo_class_MongoDB_BSON_DBPointer_jsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif ZEND_FE_END }; -static zend_class_entry *register_class_MongoDB_BSON_DBPointer(zend_class_entry *class_entry_JsonSerializable, zend_class_entry *class_entry_MongoDB_BSON_Type, zend_class_entry *class_entry_Serializable) +static zend_class_entry *register_class_MongoDB_BSON_DBPointer(zend_class_entry *class_entry_JsonSerializable, zend_class_entry *class_entry_MongoDB_BSON_Type, zend_class_entry *class_entry_Serializable, zend_class_entry *class_entry_Stringable) { zend_class_entry ce, *class_entry; INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "DBPointer", class_MongoDB_BSON_DBPointer_methods); class_entry = zend_register_internal_class_ex(&ce, NULL); class_entry->ce_flags |= ZEND_ACC_FINAL; - zend_class_implements(class_entry, 3, class_entry_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable); + zend_class_implements(class_entry, 4, class_entry_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable, class_entry_Stringable); return class_entry; } diff --git a/src/BSON/Decimal128.c b/src/BSON/Decimal128.c index 31bdebdce..3ef35cf05 100644 --- a/src/BSON/Decimal128.c +++ b/src/BSON/Decimal128.c @@ -55,13 +55,13 @@ static bool php_phongo_decimal128_init_from_hash(php_phongo_decimal128_t* intern return false; } -static HashTable* php_phongo_decimal128_get_properties_hash(phongo_compat_object_handler_type* object, bool is_temp) +static HashTable* php_phongo_decimal128_get_properties_hash(zend_object* object, bool is_temp) { php_phongo_decimal128_t* intern; HashTable* props; char outbuf[BSON_DECIMAL128_STRING] = ""; - intern = Z_OBJ_DECIMAL128(PHONGO_COMPAT_GET_OBJ(object)); + intern = Z_OBJ_DECIMAL128(object); PHONGO_GET_PROPERTY_HASH_INIT_PROPS(is_temp, intern, props, 1); @@ -202,7 +202,7 @@ static PHP_METHOD(MongoDB_BSON_Decimal128, __serialize) { PHONGO_PARSE_PARAMETERS_NONE(); - RETURN_ARR(php_phongo_decimal128_get_properties_hash(PHONGO_COMPAT_OBJ_P(getThis()), true)); + RETURN_ARR(php_phongo_decimal128_get_properties_hash(Z_OBJ_P(getThis()), true)); } static PHP_METHOD(MongoDB_BSON_Decimal128, __unserialize) @@ -243,14 +243,14 @@ static zend_object* php_phongo_decimal128_create_object(zend_class_entry* class_ return &intern->std; } -static zend_object* php_phongo_decimal128_clone_object(phongo_compat_object_handler_type* object) +static zend_object* php_phongo_decimal128_clone_object(zend_object* object) { php_phongo_decimal128_t* intern; php_phongo_decimal128_t* new_intern; zend_object* new_object; - intern = Z_OBJ_DECIMAL128(PHONGO_COMPAT_GET_OBJ(object)); - new_object = php_phongo_decimal128_create_object(PHONGO_COMPAT_GET_OBJ(object)->ce); + intern = Z_OBJ_DECIMAL128(object); + new_object = php_phongo_decimal128_create_object(object->ce); new_intern = Z_OBJ_DECIMAL128(new_object); zend_objects_clone_members(&new_intern->std, &intern->std); @@ -262,26 +262,22 @@ static zend_object* php_phongo_decimal128_clone_object(phongo_compat_object_hand return new_object; } -static HashTable* php_phongo_decimal128_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) +static HashTable* php_phongo_decimal128_get_debug_info(zend_object* object, int* is_temp) { *is_temp = 1; return php_phongo_decimal128_get_properties_hash(object, true); } -static HashTable* php_phongo_decimal128_get_properties(phongo_compat_object_handler_type* object) +static HashTable* php_phongo_decimal128_get_properties(zend_object* object) { return php_phongo_decimal128_get_properties_hash(object, false); } void php_phongo_decimal128_init_ce(INIT_FUNC_ARGS) { - php_phongo_decimal128_ce = register_class_MongoDB_BSON_Decimal128(php_phongo_decimal128_interface_ce, php_phongo_json_serializable_ce, php_phongo_type_ce, zend_ce_serializable); + php_phongo_decimal128_ce = register_class_MongoDB_BSON_Decimal128(php_phongo_decimal128_interface_ce, php_phongo_json_serializable_ce, php_phongo_type_ce, zend_ce_serializable, zend_ce_stringable); php_phongo_decimal128_ce->create_object = php_phongo_decimal128_create_object; -#if PHP_VERSION_ID >= 80000 - zend_class_implements(php_phongo_decimal128_ce, 1, zend_ce_stringable); -#endif - memcpy(&php_phongo_handler_decimal128, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); php_phongo_handler_decimal128.clone_obj = php_phongo_decimal128_clone_object; php_phongo_handler_decimal128.get_debug_info = php_phongo_decimal128_get_debug_info; diff --git a/src/BSON/Decimal128.stub.php b/src/BSON/Decimal128.stub.php index d379718b5..27e563ad9 100644 --- a/src/BSON/Decimal128.stub.php +++ b/src/BSON/Decimal128.stub.php @@ -7,7 +7,7 @@ namespace MongoDB\BSON; -final class Decimal128 implements Decimal128Interface, \JsonSerializable, Type, \Serializable +final class Decimal128 implements Decimal128Interface, \JsonSerializable, Type, \Serializable, \Stringable { final public function __construct(string $value) {} @@ -17,21 +17,11 @@ final public static function __set_state(array $properties): Decimal128 {} final public function serialize(): string {} -#if PHP_VERSION_ID >= 80000 final public function unserialize(string $data): void {} -#else - /** @param string $serialized */ - final public function unserialize($serialized): void {} -#endif final public function __unserialize(array $data): void {} final public function __serialize(): array {} -#if PHP_VERSION_ID >= 80000 final public function jsonSerialize(): mixed {} -#else - /** @return mixed */ - final public function jsonSerialize() {} -#endif } diff --git a/src/BSON/Decimal128_arginfo.h b/src/BSON/Decimal128_arginfo.h index adeeb5490..a78badcfd 100644 --- a/src/BSON/Decimal128_arginfo.h +++ b/src/BSON/Decimal128_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 032c048d73e8fe95972e1150f5925e13de4ecc94 */ + * Stub hash: e2a5c43ff506b05c576242ab76ea1cb7fd9f5c30 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Decimal128___construct, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0) @@ -14,17 +14,9 @@ ZEND_END_ARG_INFO() #define arginfo_class_MongoDB_BSON_Decimal128_serialize arginfo_class_MongoDB_BSON_Decimal128___toString -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Decimal128_unserialize, 0, 1, IS_VOID, 0) ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0) ZEND_END_ARG_INFO() -#endif - -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Decimal128_unserialize, 0, 1, IS_VOID, 0) - ZEND_ARG_INFO(0, serialized) -ZEND_END_ARG_INFO() -#endif ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Decimal128___unserialize, 0, 1, IS_VOID, 0) ZEND_ARG_TYPE_INFO(0, data, IS_ARRAY, 0) @@ -33,35 +25,18 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Decimal128___serialize, 0, 0, IS_ARRAY, 0) ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Decimal128_jsonSerialize, 0, 0, IS_MIXED, 0) ZEND_END_ARG_INFO() -#endif - -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Decimal128_jsonSerialize, 0, 0, 0) -ZEND_END_ARG_INFO() -#endif static ZEND_METHOD(MongoDB_BSON_Decimal128, __construct); static ZEND_METHOD(MongoDB_BSON_Decimal128, __toString); static ZEND_METHOD(MongoDB_BSON_Decimal128, __set_state); static ZEND_METHOD(MongoDB_BSON_Decimal128, serialize); -#if PHP_VERSION_ID >= 80000 static ZEND_METHOD(MongoDB_BSON_Decimal128, unserialize); -#endif -#if !(PHP_VERSION_ID >= 80000) -static ZEND_METHOD(MongoDB_BSON_Decimal128, unserialize); -#endif static ZEND_METHOD(MongoDB_BSON_Decimal128, __unserialize); static ZEND_METHOD(MongoDB_BSON_Decimal128, __serialize); -#if PHP_VERSION_ID >= 80000 -static ZEND_METHOD(MongoDB_BSON_Decimal128, jsonSerialize); -#endif -#if !(PHP_VERSION_ID >= 80000) static ZEND_METHOD(MongoDB_BSON_Decimal128, jsonSerialize); -#endif static const zend_function_entry class_MongoDB_BSON_Decimal128_methods[] = { @@ -69,31 +44,21 @@ static const zend_function_entry class_MongoDB_BSON_Decimal128_methods[] = { ZEND_ME(MongoDB_BSON_Decimal128, __toString, arginfo_class_MongoDB_BSON_Decimal128___toString, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_BSON_Decimal128, __set_state, arginfo_class_MongoDB_BSON_Decimal128___set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_BSON_Decimal128, serialize, arginfo_class_MongoDB_BSON_Decimal128_serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#if PHP_VERSION_ID >= 80000 ZEND_ME(MongoDB_BSON_Decimal128, unserialize, arginfo_class_MongoDB_BSON_Decimal128_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if !(PHP_VERSION_ID >= 80000) - ZEND_ME(MongoDB_BSON_Decimal128, unserialize, arginfo_class_MongoDB_BSON_Decimal128_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif ZEND_ME(MongoDB_BSON_Decimal128, __unserialize, arginfo_class_MongoDB_BSON_Decimal128___unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_BSON_Decimal128, __serialize, arginfo_class_MongoDB_BSON_Decimal128___serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#if PHP_VERSION_ID >= 80000 - ZEND_ME(MongoDB_BSON_Decimal128, jsonSerialize, arginfo_class_MongoDB_BSON_Decimal128_jsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if !(PHP_VERSION_ID >= 80000) ZEND_ME(MongoDB_BSON_Decimal128, jsonSerialize, arginfo_class_MongoDB_BSON_Decimal128_jsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif ZEND_FE_END }; -static zend_class_entry *register_class_MongoDB_BSON_Decimal128(zend_class_entry *class_entry_MongoDB_BSON_Decimal128Interface, zend_class_entry *class_entry_JsonSerializable, zend_class_entry *class_entry_MongoDB_BSON_Type, zend_class_entry *class_entry_Serializable) +static zend_class_entry *register_class_MongoDB_BSON_Decimal128(zend_class_entry *class_entry_MongoDB_BSON_Decimal128Interface, zend_class_entry *class_entry_JsonSerializable, zend_class_entry *class_entry_MongoDB_BSON_Type, zend_class_entry *class_entry_Serializable, zend_class_entry *class_entry_Stringable) { zend_class_entry ce, *class_entry; INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Decimal128", class_MongoDB_BSON_Decimal128_methods); class_entry = zend_register_internal_class_ex(&ce, NULL); class_entry->ce_flags |= ZEND_ACC_FINAL; - zend_class_implements(class_entry, 4, class_entry_MongoDB_BSON_Decimal128Interface, class_entry_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable); + zend_class_implements(class_entry, 5, class_entry_MongoDB_BSON_Decimal128Interface, class_entry_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable, class_entry_Stringable); return class_entry; } diff --git a/src/BSON/Document.c b/src/BSON/Document.c index e8f3e2dc5..92e83ab73 100644 --- a/src/BSON/Document.c +++ b/src/BSON/Document.c @@ -58,12 +58,12 @@ static bool php_phongo_document_init_from_hash(php_phongo_document_t* intern, Ha return false; } -static HashTable* php_phongo_document_get_properties_hash(phongo_compat_object_handler_type* object, bool is_temp, int size) +static HashTable* php_phongo_document_get_properties_hash(zend_object* object, bool is_temp, int size) { php_phongo_document_t* intern; HashTable* props; - intern = Z_OBJ_DOCUMENT(PHONGO_COMPAT_GET_OBJ(object)); + intern = Z_OBJ_DOCUMENT(object); PHONGO_GET_PROPERTY_HASH_INIT_PROPS(is_temp, intern, props, size); @@ -435,7 +435,7 @@ static PHP_METHOD(MongoDB_BSON_Document, __serialize) { PHONGO_PARSE_PARAMETERS_NONE(); - RETURN_ARR(php_phongo_document_get_properties_hash(PHONGO_COMPAT_OBJ_P(getThis()), true, 1)); + RETURN_ARR(php_phongo_document_get_properties_hash(Z_OBJ_P(getThis()), true, 1)); } static PHP_METHOD(MongoDB_BSON_Document, __unserialize) @@ -480,14 +480,14 @@ static zend_object* php_phongo_document_create_object(zend_class_entry* class_ty return &intern->std; } -static zend_object* php_phongo_document_clone_object(phongo_compat_object_handler_type* object) +static zend_object* php_phongo_document_clone_object(zend_object* object) { php_phongo_document_t* intern; php_phongo_document_t* new_intern; zend_object* new_object; - intern = Z_OBJ_DOCUMENT(PHONGO_COMPAT_GET_OBJ(object)); - new_object = php_phongo_document_create_object(PHONGO_COMPAT_GET_OBJ(object)->ce); + intern = Z_OBJ_DOCUMENT(object); + new_object = php_phongo_document_create_object(object->ce); new_intern = Z_OBJ_DOCUMENT(new_object); zend_objects_clone_members(&new_intern->std, &intern->std); @@ -509,13 +509,13 @@ static int php_phongo_document_compare_objects(zval* o1, zval* o2) return bson_compare(intern1->bson, intern2->bson); } -static HashTable* php_phongo_document_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) +static HashTable* php_phongo_document_get_debug_info(zend_object* object, int* is_temp) { php_phongo_document_t* intern; HashTable* props; *is_temp = 1; - intern = Z_OBJ_DOCUMENT(PHONGO_COMPAT_GET_OBJ(object)); + intern = Z_OBJ_DOCUMENT(object); /* This get_debug_info handler reports an additional property. This does not * conflict with other uses of php_phongo_document_get_properties_hash since @@ -543,20 +543,18 @@ static HashTable* php_phongo_document_get_debug_info(phongo_compat_object_handle return NULL; } -static HashTable* php_phongo_document_get_properties(phongo_compat_object_handler_type* object) +static HashTable* php_phongo_document_get_properties(zend_object* object) { return php_phongo_document_get_properties_hash(object, false, 1); } -zval* php_phongo_document_read_property(phongo_compat_object_handler_type* object, phongo_compat_property_accessor_name_type* member, int type, void** cache_slot, zval* rv) +zval* php_phongo_document_read_property(zend_object* object, zend_string* member, int type, void** cache_slot, zval* rv) { php_phongo_document_t* intern; - char* key; - size_t key_len; + char* key = ZSTR_VAL(member); + size_t key_len = ZSTR_LEN(member); - intern = Z_OBJ_DOCUMENT(PHONGO_COMPAT_GET_OBJ(object)); - - PHONGO_COMPAT_PROPERTY_ACCESSOR_NAME_TO_STRING(member, key, key_len); + intern = Z_OBJ_DOCUMENT(object); if (!php_phongo_document_get(intern, key, key_len, rv, type == BP_VAR_IS)) { // Exception already thrown @@ -566,35 +564,33 @@ zval* php_phongo_document_read_property(phongo_compat_object_handler_type* objec return rv; } -zval* php_phongo_document_write_property(phongo_compat_object_handler_type* object, phongo_compat_property_accessor_name_type* member, zval* value, void** cache_slot) +zval* php_phongo_document_write_property(zend_object* object, zend_string* member, zval* value, void** cache_slot) { phongo_throw_exception(PHONGO_ERROR_LOGIC, "Cannot write to %s property", ZSTR_VAL(php_phongo_document_ce->name)); return value; } -int php_phongo_document_has_property(phongo_compat_object_handler_type* object, phongo_compat_property_accessor_name_type* name, int has_set_exists, void** cache_slot) +int php_phongo_document_has_property(zend_object* object, zend_string* name, int has_set_exists, void** cache_slot) { php_phongo_document_t* intern; - char* key; - size_t key_len; - - intern = Z_OBJ_DOCUMENT(PHONGO_COMPAT_GET_OBJ(object)); + char* key = ZSTR_VAL(name); + size_t key_len = ZSTR_LEN(name); - PHONGO_COMPAT_PROPERTY_ACCESSOR_NAME_TO_STRING(name, key, key_len); + intern = Z_OBJ_DOCUMENT(object); return php_phongo_document_has(intern, key, key_len); } -void php_phongo_document_unset_property(phongo_compat_object_handler_type* object, phongo_compat_property_accessor_name_type* member, void** cache_slot) +void php_phongo_document_unset_property(zend_object* object, zend_string* member, void** cache_slot) { phongo_throw_exception(PHONGO_ERROR_LOGIC, "Cannot unset %s property", ZSTR_VAL(php_phongo_document_ce->name)); } -zval* php_phongo_document_read_dimension(phongo_compat_object_handler_type* object, zval* offset, int type, zval* rv) +zval* php_phongo_document_read_dimension(zend_object* object, zval* offset, int type, zval* rv) { php_phongo_document_t* intern; - intern = Z_OBJ_DOCUMENT(PHONGO_COMPAT_GET_OBJ(object)); + intern = Z_OBJ_DOCUMENT(object); if (Z_TYPE_P(offset) != IS_STRING) { if (type == BP_VAR_IS) { @@ -614,16 +610,16 @@ zval* php_phongo_document_read_dimension(phongo_compat_object_handler_type* obje return rv; } -void php_phongo_document_write_dimension(phongo_compat_object_handler_type* object, zval* offset, zval* value) +void php_phongo_document_write_dimension(zend_object* object, zval* offset, zval* value) { phongo_throw_exception(PHONGO_ERROR_LOGIC, "Cannot write to %s property", ZSTR_VAL(php_phongo_document_ce->name)); } -int php_phongo_document_has_dimension(phongo_compat_object_handler_type* object, zval* member, int check_empty) +int php_phongo_document_has_dimension(zend_object* object, zval* member, int check_empty) { php_phongo_document_t* intern; - intern = Z_OBJ_DOCUMENT(PHONGO_COMPAT_GET_OBJ(object)); + intern = Z_OBJ_DOCUMENT(object); if (Z_TYPE_P(member) != IS_STRING) { return false; @@ -632,22 +628,18 @@ int php_phongo_document_has_dimension(phongo_compat_object_handler_type* object, return php_phongo_document_has(intern, Z_STRVAL_P(member), Z_STRLEN_P(member)); } -void php_phongo_document_unset_dimension(phongo_compat_object_handler_type* object, zval* offset) +void php_phongo_document_unset_dimension(zend_object* object, zval* offset) { phongo_throw_exception(PHONGO_ERROR_LOGIC, "Cannot unset %s property", ZSTR_VAL(php_phongo_document_ce->name)); } void php_phongo_document_init_ce(INIT_FUNC_ARGS) { - php_phongo_document_ce = register_class_MongoDB_BSON_Document(zend_ce_aggregate, zend_ce_serializable, zend_ce_arrayaccess, php_phongo_type_ce); + php_phongo_document_ce = register_class_MongoDB_BSON_Document(zend_ce_aggregate, zend_ce_serializable, zend_ce_arrayaccess, php_phongo_type_ce, zend_ce_stringable); php_phongo_document_ce->create_object = php_phongo_document_create_object; -#if PHP_VERSION_ID >= 80000 - zend_class_implements(php_phongo_document_ce, 1, zend_ce_stringable); -#endif - memcpy(&php_phongo_handler_document, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); - PHONGO_COMPAT_SET_COMPARE_OBJECTS_HANDLER(document); + php_phongo_handler_document.compare = php_phongo_document_compare_objects; php_phongo_handler_document.clone_obj = php_phongo_document_clone_object; php_phongo_handler_document.get_debug_info = php_phongo_document_get_debug_info; php_phongo_handler_document.get_properties = php_phongo_document_get_properties; diff --git a/src/BSON/Document.stub.php b/src/BSON/Document.stub.php index 476b6492c..5e5c8250a 100644 --- a/src/BSON/Document.stub.php +++ b/src/BSON/Document.stub.php @@ -7,7 +7,7 @@ namespace MongoDB\BSON; -final class Document implements \IteratorAggregate, \Serializable, \ArrayAccess, Type +final class Document implements \IteratorAggregate, \Serializable, \ArrayAccess, Type, \Stringable { private function __construct() {} @@ -15,68 +15,27 @@ final static public function fromBSON(string $bson): Document {} final static public function fromJSON(string $json): Document {} -#if PHP_VERSION_ID >= 80000 final static public function fromPHP(array|object $value): Document {} -#else - /** @param array|object $value */ - final static public function fromPHP($value): Document {} -#endif -#if PHP_VERSION_ID >= 80000 final public function get(string $key): mixed {} -#else - /** @return mixed */ - final public function get(string $key) {} -#endif final public function getIterator(): Iterator {} final public function has(string $key): bool {} -#if PHP_VERSION_ID >= 80000 final public function toPHP(?array $typeMap = null): array|object {} -#else - /** @return array|object */ - final public function toPHP(?array $typeMap = null) {} -#endif final public function toCanonicalExtendedJSON(): string {} final public function toRelaxedExtendedJSON(): string {} -#if PHP_VERSION_ID >= 80000 public function offsetExists(mixed $offset): bool {} -# else - /** @param mixed $offset */ - public function offsetExists($offset): bool {} -# endif -#if PHP_VERSION_ID >= 80000 public function offsetGet(mixed $offset): mixed {} -# else - /** - * @param mixed $offset - * @return mixed - */ - public function offsetGet($offset) {} -# endif - -#if PHP_VERSION_ID >= 80000 + public function offsetSet(mixed $offset, mixed $value): void {} -# else - /** - * @param mixed $offset - * @param mixed $value - */ - public function offsetSet($offset, $value): void {} -# endif - -#if PHP_VERSION_ID >= 80000 + public function offsetUnset(mixed $offset): void {} -# else - /** @param mixed $offset */ - public function offsetUnset($offset): void {} -# endif final public function __toString(): string {} @@ -84,12 +43,7 @@ final public static function __set_state(array $properties): Document {} final public function serialize(): string {} -#if PHP_VERSION_ID >= 80000 final public function unserialize(string $data): void {} -#else - /** @param string $serialized */ - final public function unserialize($serialized): void {} -#endif final public function __unserialize(array $data): void {} diff --git a/src/BSON/Document_arginfo.h b/src/BSON/Document_arginfo.h index 2f08b5ced..955ea571a 100644 --- a/src/BSON/Document_arginfo.h +++ b/src/BSON/Document_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 54b11bb7d4058f4f279b2df828650b5eb1225882 */ + * Stub hash: 4efc86c2e070f6d6a8dd5cbfe6ea126fba9a4251 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Document___construct, 0, 0, 0) ZEND_END_ARG_INFO() @@ -12,29 +12,13 @@ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_BSON_Document_fromJ ZEND_ARG_TYPE_INFO(0, json, IS_STRING, 0) ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_BSON_Document_fromPHP, 0, 1, MongoDB\\BSON\\Document, 0) ZEND_ARG_TYPE_MASK(0, value, MAY_BE_ARRAY|MAY_BE_OBJECT, NULL) ZEND_END_ARG_INFO() -#endif -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_BSON_Document_fromPHP, 0, 1, MongoDB\\BSON\\Document, 0) - ZEND_ARG_INFO(0, value) -ZEND_END_ARG_INFO() -#endif - -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Document_get, 0, 1, IS_MIXED, 0) ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0) ZEND_END_ARG_INFO() -#endif - -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Document_get, 0, 0, 1) - ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0) -ZEND_END_ARG_INFO() -#endif ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_BSON_Document_getIterator, 0, 0, MongoDB\\BSON\\Iterator, 0) ZEND_END_ARG_INFO() @@ -43,72 +27,31 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Document_has, ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0) ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_class_MongoDB_BSON_Document_toPHP, 0, 0, MAY_BE_ARRAY|MAY_BE_OBJECT) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, typeMap, IS_ARRAY, 1, "null") ZEND_END_ARG_INFO() -#endif - -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Document_toPHP, 0, 0, 0) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, typeMap, IS_ARRAY, 1, "null") -ZEND_END_ARG_INFO() -#endif ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Document_toCanonicalExtendedJSON, 0, 0, IS_STRING, 0) ZEND_END_ARG_INFO() #define arginfo_class_MongoDB_BSON_Document_toRelaxedExtendedJSON arginfo_class_MongoDB_BSON_Document_toCanonicalExtendedJSON -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Document_offsetExists, 0, 1, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, offset, IS_MIXED, 0) ZEND_END_ARG_INFO() -#endif - -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Document_offsetExists, 0, 1, _IS_BOOL, 0) - ZEND_ARG_INFO(0, offset) -ZEND_END_ARG_INFO() -#endif -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Document_offsetGet, 0, 1, IS_MIXED, 0) ZEND_ARG_TYPE_INFO(0, offset, IS_MIXED, 0) ZEND_END_ARG_INFO() -#endif -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Document_offsetGet, 0, 0, 1) - ZEND_ARG_INFO(0, offset) -ZEND_END_ARG_INFO() -#endif - -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Document_offsetSet, 0, 2, IS_VOID, 0) ZEND_ARG_TYPE_INFO(0, offset, IS_MIXED, 0) ZEND_ARG_TYPE_INFO(0, value, IS_MIXED, 0) ZEND_END_ARG_INFO() -#endif - -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Document_offsetSet, 0, 2, IS_VOID, 0) - ZEND_ARG_INFO(0, offset) - ZEND_ARG_INFO(0, value) -ZEND_END_ARG_INFO() -#endif -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Document_offsetUnset, 0, 1, IS_VOID, 0) ZEND_ARG_TYPE_INFO(0, offset, IS_MIXED, 0) ZEND_END_ARG_INFO() -#endif - -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Document_offsetUnset, 0, 1, IS_VOID, 0) - ZEND_ARG_INFO(0, offset) -ZEND_END_ARG_INFO() -#endif #define arginfo_class_MongoDB_BSON_Document___toString arginfo_class_MongoDB_BSON_Document_toCanonicalExtendedJSON @@ -118,17 +61,9 @@ ZEND_END_ARG_INFO() #define arginfo_class_MongoDB_BSON_Document_serialize arginfo_class_MongoDB_BSON_Document_toCanonicalExtendedJSON -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Document_unserialize, 0, 1, IS_VOID, 0) ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0) ZEND_END_ARG_INFO() -#endif - -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Document_unserialize, 0, 1, IS_VOID, 0) - ZEND_ARG_INFO(0, serialized) -ZEND_END_ARG_INFO() -#endif ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Document___unserialize, 0, 1, IS_VOID, 0) ZEND_ARG_TYPE_INFO(0, data, IS_ARRAY, 0) @@ -141,61 +76,21 @@ ZEND_END_ARG_INFO() static ZEND_METHOD(MongoDB_BSON_Document, __construct); static ZEND_METHOD(MongoDB_BSON_Document, fromBSON); static ZEND_METHOD(MongoDB_BSON_Document, fromJSON); -#if PHP_VERSION_ID >= 80000 static ZEND_METHOD(MongoDB_BSON_Document, fromPHP); -#endif -#if !(PHP_VERSION_ID >= 80000) -static ZEND_METHOD(MongoDB_BSON_Document, fromPHP); -#endif -#if PHP_VERSION_ID >= 80000 -static ZEND_METHOD(MongoDB_BSON_Document, get); -#endif -#if !(PHP_VERSION_ID >= 80000) static ZEND_METHOD(MongoDB_BSON_Document, get); -#endif static ZEND_METHOD(MongoDB_BSON_Document, getIterator); static ZEND_METHOD(MongoDB_BSON_Document, has); -#if PHP_VERSION_ID >= 80000 static ZEND_METHOD(MongoDB_BSON_Document, toPHP); -#endif -#if !(PHP_VERSION_ID >= 80000) -static ZEND_METHOD(MongoDB_BSON_Document, toPHP); -#endif static ZEND_METHOD(MongoDB_BSON_Document, toCanonicalExtendedJSON); static ZEND_METHOD(MongoDB_BSON_Document, toRelaxedExtendedJSON); -#if PHP_VERSION_ID >= 80000 -static ZEND_METHOD(MongoDB_BSON_Document, offsetExists); -#endif -#if !(PHP_VERSION_ID >= 80000) static ZEND_METHOD(MongoDB_BSON_Document, offsetExists); -#endif -#if PHP_VERSION_ID >= 80000 -static ZEND_METHOD(MongoDB_BSON_Document, offsetGet); -#endif -#if !(PHP_VERSION_ID >= 80000) static ZEND_METHOD(MongoDB_BSON_Document, offsetGet); -#endif -#if PHP_VERSION_ID >= 80000 static ZEND_METHOD(MongoDB_BSON_Document, offsetSet); -#endif -#if !(PHP_VERSION_ID >= 80000) -static ZEND_METHOD(MongoDB_BSON_Document, offsetSet); -#endif -#if PHP_VERSION_ID >= 80000 -static ZEND_METHOD(MongoDB_BSON_Document, offsetUnset); -#endif -#if !(PHP_VERSION_ID >= 80000) static ZEND_METHOD(MongoDB_BSON_Document, offsetUnset); -#endif static ZEND_METHOD(MongoDB_BSON_Document, __toString); static ZEND_METHOD(MongoDB_BSON_Document, __set_state); static ZEND_METHOD(MongoDB_BSON_Document, serialize); -#if PHP_VERSION_ID >= 80000 static ZEND_METHOD(MongoDB_BSON_Document, unserialize); -#endif -#if !(PHP_VERSION_ID >= 80000) -static ZEND_METHOD(MongoDB_BSON_Document, unserialize); -#endif static ZEND_METHOD(MongoDB_BSON_Document, __unserialize); static ZEND_METHOD(MongoDB_BSON_Document, __serialize); @@ -204,74 +99,34 @@ static const zend_function_entry class_MongoDB_BSON_Document_methods[] = { ZEND_ME(MongoDB_BSON_Document, __construct, arginfo_class_MongoDB_BSON_Document___construct, ZEND_ACC_PRIVATE) ZEND_ME(MongoDB_BSON_Document, fromBSON, arginfo_class_MongoDB_BSON_Document_fromBSON, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_BSON_Document, fromJSON, arginfo_class_MongoDB_BSON_Document_fromJSON, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL) -#if PHP_VERSION_ID >= 80000 - ZEND_ME(MongoDB_BSON_Document, fromPHP, arginfo_class_MongoDB_BSON_Document_fromPHP, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL) -#endif -#if !(PHP_VERSION_ID >= 80000) ZEND_ME(MongoDB_BSON_Document, fromPHP, arginfo_class_MongoDB_BSON_Document_fromPHP, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL) -#endif -#if PHP_VERSION_ID >= 80000 - ZEND_ME(MongoDB_BSON_Document, get, arginfo_class_MongoDB_BSON_Document_get, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if !(PHP_VERSION_ID >= 80000) ZEND_ME(MongoDB_BSON_Document, get, arginfo_class_MongoDB_BSON_Document_get, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif ZEND_ME(MongoDB_BSON_Document, getIterator, arginfo_class_MongoDB_BSON_Document_getIterator, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_BSON_Document, has, arginfo_class_MongoDB_BSON_Document_has, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#if PHP_VERSION_ID >= 80000 ZEND_ME(MongoDB_BSON_Document, toPHP, arginfo_class_MongoDB_BSON_Document_toPHP, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if !(PHP_VERSION_ID >= 80000) - ZEND_ME(MongoDB_BSON_Document, toPHP, arginfo_class_MongoDB_BSON_Document_toPHP, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif ZEND_ME(MongoDB_BSON_Document, toCanonicalExtendedJSON, arginfo_class_MongoDB_BSON_Document_toCanonicalExtendedJSON, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_BSON_Document, toRelaxedExtendedJSON, arginfo_class_MongoDB_BSON_Document_toRelaxedExtendedJSON, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#if PHP_VERSION_ID >= 80000 - ZEND_ME(MongoDB_BSON_Document, offsetExists, arginfo_class_MongoDB_BSON_Document_offsetExists, ZEND_ACC_PUBLIC) -#endif -#if !(PHP_VERSION_ID >= 80000) ZEND_ME(MongoDB_BSON_Document, offsetExists, arginfo_class_MongoDB_BSON_Document_offsetExists, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 ZEND_ME(MongoDB_BSON_Document, offsetGet, arginfo_class_MongoDB_BSON_Document_offsetGet, ZEND_ACC_PUBLIC) -#endif -#if !(PHP_VERSION_ID >= 80000) - ZEND_ME(MongoDB_BSON_Document, offsetGet, arginfo_class_MongoDB_BSON_Document_offsetGet, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - ZEND_ME(MongoDB_BSON_Document, offsetSet, arginfo_class_MongoDB_BSON_Document_offsetSet, ZEND_ACC_PUBLIC) -#endif -#if !(PHP_VERSION_ID >= 80000) ZEND_ME(MongoDB_BSON_Document, offsetSet, arginfo_class_MongoDB_BSON_Document_offsetSet, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 ZEND_ME(MongoDB_BSON_Document, offsetUnset, arginfo_class_MongoDB_BSON_Document_offsetUnset, ZEND_ACC_PUBLIC) -#endif -#if !(PHP_VERSION_ID >= 80000) - ZEND_ME(MongoDB_BSON_Document, offsetUnset, arginfo_class_MongoDB_BSON_Document_offsetUnset, ZEND_ACC_PUBLIC) -#endif ZEND_ME(MongoDB_BSON_Document, __toString, arginfo_class_MongoDB_BSON_Document___toString, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_BSON_Document, __set_state, arginfo_class_MongoDB_BSON_Document___set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_BSON_Document, serialize, arginfo_class_MongoDB_BSON_Document_serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#if PHP_VERSION_ID >= 80000 - ZEND_ME(MongoDB_BSON_Document, unserialize, arginfo_class_MongoDB_BSON_Document_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if !(PHP_VERSION_ID >= 80000) ZEND_ME(MongoDB_BSON_Document, unserialize, arginfo_class_MongoDB_BSON_Document_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif ZEND_ME(MongoDB_BSON_Document, __unserialize, arginfo_class_MongoDB_BSON_Document___unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_BSON_Document, __serialize, arginfo_class_MongoDB_BSON_Document___serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_FE_END }; -static zend_class_entry *register_class_MongoDB_BSON_Document(zend_class_entry *class_entry_IteratorAggregate, zend_class_entry *class_entry_Serializable, zend_class_entry *class_entry_ArrayAccess, zend_class_entry *class_entry_MongoDB_BSON_Type) +static zend_class_entry *register_class_MongoDB_BSON_Document(zend_class_entry *class_entry_IteratorAggregate, zend_class_entry *class_entry_Serializable, zend_class_entry *class_entry_ArrayAccess, zend_class_entry *class_entry_MongoDB_BSON_Type, zend_class_entry *class_entry_Stringable) { zend_class_entry ce, *class_entry; INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Document", class_MongoDB_BSON_Document_methods); class_entry = zend_register_internal_class_ex(&ce, NULL); class_entry->ce_flags |= ZEND_ACC_FINAL; - zend_class_implements(class_entry, 4, class_entry_IteratorAggregate, class_entry_Serializable, class_entry_ArrayAccess, class_entry_MongoDB_BSON_Type); + zend_class_implements(class_entry, 5, class_entry_IteratorAggregate, class_entry_Serializable, class_entry_ArrayAccess, class_entry_MongoDB_BSON_Type, class_entry_Stringable); return class_entry; } diff --git a/src/BSON/Int64.c b/src/BSON/Int64.c index 77da1bfc1..dae06bc7c 100644 --- a/src/BSON/Int64.c +++ b/src/BSON/Int64.c @@ -64,12 +64,12 @@ static bool php_phongo_int64_init_from_hash(php_phongo_int64_t* intern, HashTabl return false; } -HashTable* php_phongo_int64_get_properties_hash(phongo_compat_object_handler_type* object, bool is_temp) +HashTable* php_phongo_int64_get_properties_hash(zend_object* object, bool is_temp) { php_phongo_int64_t* intern; HashTable* props; - intern = Z_OBJ_INT64(PHONGO_COMPAT_GET_OBJ(object)); + intern = Z_OBJ_INT64(object); PHONGO_GET_PROPERTY_HASH_INIT_PROPS(is_temp, intern, props, 2); @@ -207,7 +207,7 @@ static PHP_METHOD(MongoDB_BSON_Int64, __serialize) { PHONGO_PARSE_PARAMETERS_NONE(); - RETURN_ARR(php_phongo_int64_get_properties_hash(PHONGO_COMPAT_OBJ_P(getThis()), true)); + RETURN_ARR(php_phongo_int64_get_properties_hash(Z_OBJ_P(getThis()), true)); } static PHP_METHOD(MongoDB_BSON_Int64, __unserialize) @@ -248,14 +248,14 @@ zend_object* php_phongo_int64_create_object(zend_class_entry* class_type) return &intern->std; } -static zend_object* php_phongo_int64_clone_object(phongo_compat_object_handler_type* object) +static zend_object* php_phongo_int64_clone_object(zend_object* object) { php_phongo_int64_t* intern; php_phongo_int64_t* new_intern; zend_object* new_object; - intern = Z_OBJ_INT64(PHONGO_COMPAT_GET_OBJ(object)); - new_object = php_phongo_int64_create_object(PHONGO_COMPAT_GET_OBJ(object)->ce); + intern = Z_OBJ_INT64(object); + new_object = php_phongo_int64_create_object(object->ce); new_intern = Z_OBJ_INT64(new_object); zend_objects_clone_members(&new_intern->std, &intern->std); @@ -345,58 +345,11 @@ static int php_phongo_int64_compare_objects(zval* o1, zval* o2) return 0; } -#if PHP_VERSION_ID < 80000 -static int php_phongo_int64_compare_with_other_type(zval* object, zval* value) -{ - zval tmp_value; - zval result; - int ret; - - if (Z_OBJ_HT_P(object)->cast_object(object, &tmp_value, ((Z_TYPE_P(value) == IS_FALSE || Z_TYPE_P(value) == IS_TRUE) ? _IS_BOOL : Z_TYPE_P(value))) == FAILURE) { - zval_ptr_dtor(&tmp_value); - return 1; - } - - compare_function(&result, &tmp_value, value); - - ret = Z_LVAL(result); - zval_ptr_dtor(&tmp_value); - zval_ptr_dtor(&result); - - return ret; -} - -static int php_phongo_int64_compare_zvals(zval* result, zval* op1, zval* op2) -{ - /* Happy case: compare an int64 object with another object, long, or double */ - if ((php_phongo_int64_is_int64_object(op1) || php_phongo_int64_is_long_or_double(op1)) && (php_phongo_int64_is_int64_object(op2) || php_phongo_int64_is_long_or_double(op2))) { - ZVAL_LONG(result, php_phongo_int64_compare_objects(op1, op2)); - return SUCCESS; - } - - /* When comparing an int64 object with any other type, cast the int64 object to the desired type. - * We know that if op1 is an object, op2 has to be the other type and vice versa. For op2 being - * the object, we can again flip the values used for comparison and multiply the result with -1. */ - - if (php_phongo_int64_is_int64_object(op1)) { - ZVAL_LONG(result, php_phongo_int64_compare_with_other_type(op1, op2)); - return SUCCESS; - } - - if (php_phongo_int64_is_int64_object(op2)) { - ZVAL_LONG(result, -1 * php_phongo_int64_compare_with_other_type(op2, op1)); - return SUCCESS; - } - - return FAILURE; -} -#endif - -static zend_result php_phongo_int64_cast_object(phongo_compat_object_handler_type* readobj, zval* retval, int type) +static zend_result php_phongo_int64_cast_object(zend_object* readobj, zval* retval, int type) { php_phongo_int64_t* intern; - intern = Z_OBJ_INT64(PHONGO_COMPAT_GET_OBJ(readobj)); + intern = Z_OBJ_INT64(readobj); switch (type) { case IS_DOUBLE: @@ -645,28 +598,24 @@ static zend_result php_phongo_int64_do_operation(zend_uchar opcode, zval* result #undef PHONGO_GET_INT64 #undef INT64_SIGN_MASK -static HashTable* php_phongo_int64_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) +static HashTable* php_phongo_int64_get_debug_info(zend_object* object, int* is_temp) { *is_temp = 1; return php_phongo_int64_get_properties_hash(object, true); } -static HashTable* php_phongo_int64_get_properties(phongo_compat_object_handler_type* object) +static HashTable* php_phongo_int64_get_properties(zend_object* object) { return php_phongo_int64_get_properties_hash(object, false); } void php_phongo_int64_init_ce(INIT_FUNC_ARGS) { - php_phongo_int64_ce = register_class_MongoDB_BSON_Int64(php_phongo_json_serializable_ce, php_phongo_type_ce, zend_ce_serializable); + php_phongo_int64_ce = register_class_MongoDB_BSON_Int64(php_phongo_json_serializable_ce, php_phongo_type_ce, zend_ce_serializable, zend_ce_stringable); php_phongo_int64_ce->create_object = php_phongo_int64_create_object; -#if PHP_VERSION_ID >= 80000 - zend_class_implements(php_phongo_int64_ce, 1, zend_ce_stringable); -#endif - memcpy(&php_phongo_handler_int64, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); - PHONGO_COMPAT_SET_COMPARE_OBJECTS_HANDLER(int64); + php_phongo_handler_int64.compare = php_phongo_int64_compare_objects; php_phongo_handler_int64.clone_obj = php_phongo_int64_clone_object; php_phongo_handler_int64.get_debug_info = php_phongo_int64_get_debug_info; php_phongo_handler_int64.get_properties = php_phongo_int64_get_properties; @@ -674,12 +623,6 @@ void php_phongo_int64_init_ce(INIT_FUNC_ARGS) php_phongo_handler_int64.offset = XtOffsetOf(php_phongo_int64_t, std); php_phongo_handler_int64.cast_object = php_phongo_int64_cast_object; php_phongo_handler_int64.do_operation = php_phongo_int64_do_operation; - - /* On PHP 7.4, compare_objects is only used when comparing two objects. - * Use the compare handler to compare an object with any other zval */ -#if PHP_VERSION_ID < 80000 - php_phongo_handler_int64.compare = php_phongo_int64_compare_zvals; -#endif } bool phongo_int64_new(zval* object, int64_t integer) diff --git a/src/BSON/Int64.stub.php b/src/BSON/Int64.stub.php index ba1e69fdf..4e22256c5 100644 --- a/src/BSON/Int64.stub.php +++ b/src/BSON/Int64.stub.php @@ -7,14 +7,9 @@ namespace MongoDB\BSON; -final class Int64 implements \JsonSerializable, Type, \Serializable +final class Int64 implements \JsonSerializable, Type, \Serializable, \Stringable { -#if PHP_VERSION_ID >= 80000 final public function __construct(int|string $value) {} -#else - /** @param int|string $value */ - final public function __construct($value) {} -#endif final public function __toString(): string {} @@ -22,21 +17,11 @@ final public static function __set_state(array $properties): Int64 {} final public function serialize(): string {} -#if PHP_VERSION_ID >= 80000 final public function unserialize(string $data): void {} -#else - /** @param string $serialized */ - final public function unserialize($serialized): void {} -#endif final public function __unserialize(array $data): void {} final public function __serialize(): array {} -#if PHP_VERSION_ID >= 80000 final public function jsonSerialize(): mixed {} -#else - /** @return mixed */ - final public function jsonSerialize() {} -#endif } diff --git a/src/BSON/Int64_arginfo.h b/src/BSON/Int64_arginfo.h index 8b1eb3ffe..27f4c7708 100644 --- a/src/BSON/Int64_arginfo.h +++ b/src/BSON/Int64_arginfo.h @@ -1,17 +1,9 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 86352e04686201023d5cad5ee577c8a3ce324628 */ + * Stub hash: 26a7fdee9a7adefd7d6877669d4d28b9c68d8153 */ -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Int64___construct, 0, 0, 1) ZEND_ARG_TYPE_MASK(0, value, MAY_BE_LONG|MAY_BE_STRING, NULL) ZEND_END_ARG_INFO() -#endif - -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Int64___construct, 0, 0, 1) - ZEND_ARG_INFO(0, value) -ZEND_END_ARG_INFO() -#endif ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Int64___toString, 0, 0, IS_STRING, 0) ZEND_END_ARG_INFO() @@ -22,17 +14,9 @@ ZEND_END_ARG_INFO() #define arginfo_class_MongoDB_BSON_Int64_serialize arginfo_class_MongoDB_BSON_Int64___toString -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Int64_unserialize, 0, 1, IS_VOID, 0) ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0) ZEND_END_ARG_INFO() -#endif - -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Int64_unserialize, 0, 1, IS_VOID, 0) - ZEND_ARG_INFO(0, serialized) -ZEND_END_ARG_INFO() -#endif ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Int64___unserialize, 0, 1, IS_VOID, 0) ZEND_ARG_TYPE_INFO(0, data, IS_ARRAY, 0) @@ -41,77 +25,40 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Int64___serialize, 0, 0, IS_ARRAY, 0) ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Int64_jsonSerialize, 0, 0, IS_MIXED, 0) ZEND_END_ARG_INFO() -#endif - -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Int64_jsonSerialize, 0, 0, 0) -ZEND_END_ARG_INFO() -#endif -#if PHP_VERSION_ID >= 80000 -static ZEND_METHOD(MongoDB_BSON_Int64, __construct); -#endif -#if !(PHP_VERSION_ID >= 80000) static ZEND_METHOD(MongoDB_BSON_Int64, __construct); -#endif static ZEND_METHOD(MongoDB_BSON_Int64, __toString); static ZEND_METHOD(MongoDB_BSON_Int64, __set_state); static ZEND_METHOD(MongoDB_BSON_Int64, serialize); -#if PHP_VERSION_ID >= 80000 static ZEND_METHOD(MongoDB_BSON_Int64, unserialize); -#endif -#if !(PHP_VERSION_ID >= 80000) -static ZEND_METHOD(MongoDB_BSON_Int64, unserialize); -#endif static ZEND_METHOD(MongoDB_BSON_Int64, __unserialize); static ZEND_METHOD(MongoDB_BSON_Int64, __serialize); -#if PHP_VERSION_ID >= 80000 -static ZEND_METHOD(MongoDB_BSON_Int64, jsonSerialize); -#endif -#if !(PHP_VERSION_ID >= 80000) static ZEND_METHOD(MongoDB_BSON_Int64, jsonSerialize); -#endif static const zend_function_entry class_MongoDB_BSON_Int64_methods[] = { -#if PHP_VERSION_ID >= 80000 ZEND_ME(MongoDB_BSON_Int64, __construct, arginfo_class_MongoDB_BSON_Int64___construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if !(PHP_VERSION_ID >= 80000) - ZEND_ME(MongoDB_BSON_Int64, __construct, arginfo_class_MongoDB_BSON_Int64___construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif ZEND_ME(MongoDB_BSON_Int64, __toString, arginfo_class_MongoDB_BSON_Int64___toString, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_BSON_Int64, __set_state, arginfo_class_MongoDB_BSON_Int64___set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_BSON_Int64, serialize, arginfo_class_MongoDB_BSON_Int64_serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#if PHP_VERSION_ID >= 80000 - ZEND_ME(MongoDB_BSON_Int64, unserialize, arginfo_class_MongoDB_BSON_Int64_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if !(PHP_VERSION_ID >= 80000) ZEND_ME(MongoDB_BSON_Int64, unserialize, arginfo_class_MongoDB_BSON_Int64_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif ZEND_ME(MongoDB_BSON_Int64, __unserialize, arginfo_class_MongoDB_BSON_Int64___unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_BSON_Int64, __serialize, arginfo_class_MongoDB_BSON_Int64___serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#if PHP_VERSION_ID >= 80000 - ZEND_ME(MongoDB_BSON_Int64, jsonSerialize, arginfo_class_MongoDB_BSON_Int64_jsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if !(PHP_VERSION_ID >= 80000) ZEND_ME(MongoDB_BSON_Int64, jsonSerialize, arginfo_class_MongoDB_BSON_Int64_jsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif ZEND_FE_END }; -static zend_class_entry *register_class_MongoDB_BSON_Int64(zend_class_entry *class_entry_JsonSerializable, zend_class_entry *class_entry_MongoDB_BSON_Type, zend_class_entry *class_entry_Serializable) +static zend_class_entry *register_class_MongoDB_BSON_Int64(zend_class_entry *class_entry_JsonSerializable, zend_class_entry *class_entry_MongoDB_BSON_Type, zend_class_entry *class_entry_Serializable, zend_class_entry *class_entry_Stringable) { zend_class_entry ce, *class_entry; INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Int64", class_MongoDB_BSON_Int64_methods); class_entry = zend_register_internal_class_ex(&ce, NULL); class_entry->ce_flags |= ZEND_ACC_FINAL; - zend_class_implements(class_entry, 3, class_entry_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable); + zend_class_implements(class_entry, 4, class_entry_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable, class_entry_Stringable); return class_entry; } diff --git a/src/BSON/Iterator.c b/src/BSON/Iterator.c index 59ba5f3d9..881ed4d62 100644 --- a/src/BSON/Iterator.c +++ b/src/BSON/Iterator.c @@ -153,12 +153,12 @@ static void php_phongo_iterator_rewind(php_phongo_iterator_t* intern) intern->valid = bson_iter_next(&intern->iter); } -static HashTable* php_phongo_iterator_get_properties_hash(phongo_compat_object_handler_type* object, bool is_temp) +static HashTable* php_phongo_iterator_get_properties_hash(zend_object* object, bool is_temp) { php_phongo_iterator_t* intern; HashTable* props; - intern = Z_OBJ_ITERATOR(PHONGO_COMPAT_GET_OBJ(object)); + intern = Z_OBJ_ITERATOR(object); PHONGO_GET_PROPERTY_HASH_INIT_PROPS(is_temp, intern, props, 1); @@ -270,14 +270,14 @@ static zend_object* php_phongo_iterator_create_object(zend_class_entry* class_ty return &intern->std; } -static zend_object* php_phongo_iterator_clone_object(phongo_compat_object_handler_type* object) +static zend_object* php_phongo_iterator_clone_object(zend_object* object) { php_phongo_iterator_t* intern; php_phongo_iterator_t* new_intern; zend_object* new_object; - intern = Z_OBJ_ITERATOR(PHONGO_COMPAT_GET_OBJ(object)); - new_object = php_phongo_iterator_create_object(PHONGO_COMPAT_GET_OBJ(object)->ce); + intern = Z_OBJ_ITERATOR(object); + new_object = php_phongo_iterator_create_object(object->ce); new_intern = Z_OBJ_ITERATOR(new_object); php_phongo_iterator_init_with_zval(new_intern, &intern->bson); @@ -286,13 +286,13 @@ static zend_object* php_phongo_iterator_clone_object(phongo_compat_object_handle return new_object; } -static HashTable* php_phongo_iterator_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) +static HashTable* php_phongo_iterator_get_debug_info(zend_object* object, int* is_temp) { *is_temp = 1; return php_phongo_iterator_get_properties_hash(object, true); } -static HashTable* php_phongo_iterator_get_properties(phongo_compat_object_handler_type* object) +static HashTable* php_phongo_iterator_get_properties(zend_object* object) { return php_phongo_iterator_get_properties_hash(object, false); } @@ -341,16 +341,14 @@ static void php_phongo_iterator_it_rewind(zend_object_iterator* iter) php_phongo_iterator_rewind(intern); } -#if PHP_VERSION_ID >= 80000 static HashTable* php_phongo_iterator_it_get_gc(zend_object_iterator* iter, zval** table, int* n) { *n = 1; *table = &iter->data; return NULL; } -#endif -static const zend_object_iterator_funcs php_phongo_iterator_it_funcs = PHONGO_ITERATOR_FUNCS( +static const zend_object_iterator_funcs php_phongo_iterator_it_funcs = { php_phongo_iterator_it_dtor, php_phongo_iterator_it_valid, php_phongo_iterator_it_get_current_data, @@ -358,7 +356,8 @@ static const zend_object_iterator_funcs php_phongo_iterator_it_funcs = PHONGO_IT php_phongo_iterator_it_move_forward, php_phongo_iterator_it_rewind, NULL, /* invalidate_current */ - php_phongo_iterator_it_get_gc); + php_phongo_iterator_it_get_gc +}; static zend_object_iterator* php_phongo_iterator_get_iterator(zend_class_entry* ce, zval* object, int by_ref) { @@ -384,7 +383,6 @@ void php_phongo_iterator_init_ce(INIT_FUNC_ARGS) php_phongo_iterator_ce = register_class_MongoDB_BSON_Iterator(zend_ce_iterator); php_phongo_iterator_ce->create_object = php_phongo_iterator_create_object; php_phongo_iterator_ce->get_iterator = php_phongo_iterator_get_iterator; - PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_iterator_ce); memcpy(&php_phongo_handler_iterator, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); php_phongo_handler_iterator.clone_obj = php_phongo_iterator_clone_object; diff --git a/src/BSON/Iterator.stub.php b/src/BSON/Iterator.stub.php index a2530b594..974499b6c 100644 --- a/src/BSON/Iterator.stub.php +++ b/src/BSON/Iterator.stub.php @@ -7,23 +7,14 @@ namespace MongoDB\BSON; +/** @not-serializable */ final class Iterator implements \Iterator { final private function __construct() {} -#if PHP_VERSION_ID >= 80000 final public function current(): mixed {} -#else - /** @return mixed */ - final public function current() {} -#endif -#if PHP_VERSION_ID >= 80000 final public function key(): string|int {} -#else - /** @return string|int */ - final public function key() {} -#endif final public function next(): void {} diff --git a/src/BSON/Iterator_arginfo.h b/src/BSON/Iterator_arginfo.h index c9786ef42..95b8b355f 100644 --- a/src/BSON/Iterator_arginfo.h +++ b/src/BSON/Iterator_arginfo.h @@ -1,27 +1,14 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 739694e46e6c871380ef1708b2f824e19651621b */ + * Stub hash: b1cb9bc973c616b9ec005232e95368bf1b233480 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Iterator___construct, 0, 0, 0) ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Iterator_current, 0, 0, IS_MIXED, 0) ZEND_END_ARG_INFO() -#endif -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Iterator_current, 0, 0, 0) -ZEND_END_ARG_INFO() -#endif - -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_class_MongoDB_BSON_Iterator_key, 0, 0, MAY_BE_STRING|MAY_BE_LONG) ZEND_END_ARG_INFO() -#endif - -#if !(PHP_VERSION_ID >= 80000) -#define arginfo_class_MongoDB_BSON_Iterator_key arginfo_class_MongoDB_BSON_Iterator_current -#endif ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Iterator_next, 0, 0, IS_VOID, 0) ZEND_END_ARG_INFO() @@ -33,18 +20,8 @@ ZEND_END_ARG_INFO() static ZEND_METHOD(MongoDB_BSON_Iterator, __construct); -#if PHP_VERSION_ID >= 80000 -static ZEND_METHOD(MongoDB_BSON_Iterator, current); -#endif -#if !(PHP_VERSION_ID >= 80000) static ZEND_METHOD(MongoDB_BSON_Iterator, current); -#endif -#if PHP_VERSION_ID >= 80000 static ZEND_METHOD(MongoDB_BSON_Iterator, key); -#endif -#if !(PHP_VERSION_ID >= 80000) -static ZEND_METHOD(MongoDB_BSON_Iterator, key); -#endif static ZEND_METHOD(MongoDB_BSON_Iterator, next); static ZEND_METHOD(MongoDB_BSON_Iterator, rewind); static ZEND_METHOD(MongoDB_BSON_Iterator, valid); @@ -52,18 +29,8 @@ static ZEND_METHOD(MongoDB_BSON_Iterator, valid); static const zend_function_entry class_MongoDB_BSON_Iterator_methods[] = { ZEND_ME(MongoDB_BSON_Iterator, __construct, arginfo_class_MongoDB_BSON_Iterator___construct, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL) -#if PHP_VERSION_ID >= 80000 - ZEND_ME(MongoDB_BSON_Iterator, current, arginfo_class_MongoDB_BSON_Iterator_current, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if !(PHP_VERSION_ID >= 80000) ZEND_ME(MongoDB_BSON_Iterator, current, arginfo_class_MongoDB_BSON_Iterator_current, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if PHP_VERSION_ID >= 80000 - ZEND_ME(MongoDB_BSON_Iterator, key, arginfo_class_MongoDB_BSON_Iterator_key, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if !(PHP_VERSION_ID >= 80000) ZEND_ME(MongoDB_BSON_Iterator, key, arginfo_class_MongoDB_BSON_Iterator_key, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif ZEND_ME(MongoDB_BSON_Iterator, next, arginfo_class_MongoDB_BSON_Iterator_next, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_BSON_Iterator, rewind, arginfo_class_MongoDB_BSON_Iterator_rewind, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_BSON_Iterator, valid, arginfo_class_MongoDB_BSON_Iterator_valid, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) @@ -76,7 +43,7 @@ static zend_class_entry *register_class_MongoDB_BSON_Iterator(zend_class_entry * INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Iterator", class_MongoDB_BSON_Iterator_methods); class_entry = zend_register_internal_class_ex(&ce, NULL); - class_entry->ce_flags |= ZEND_ACC_FINAL; + class_entry->ce_flags |= ZEND_ACC_FINAL|ZEND_ACC_NOT_SERIALIZABLE; zend_class_implements(class_entry, 1, class_entry_Iterator); return class_entry; diff --git a/src/BSON/Javascript.c b/src/BSON/Javascript.c index 7f8fdd609..9dbd5b8b7 100644 --- a/src/BSON/Javascript.c +++ b/src/BSON/Javascript.c @@ -71,12 +71,12 @@ static bool php_phongo_javascript_init_from_hash(php_phongo_javascript_t* intern return false; } -HashTable* php_phongo_javascript_get_properties_hash(phongo_compat_object_handler_type* object, bool is_temp) +HashTable* php_phongo_javascript_get_properties_hash(zend_object* object, bool is_temp) { php_phongo_javascript_t* intern; HashTable* props; - intern = Z_OBJ_JAVASCRIPT(PHONGO_COMPAT_GET_OBJ(object)); + intern = Z_OBJ_JAVASCRIPT(object); PHONGO_GET_PROPERTY_HASH_INIT_PROPS(is_temp, intern, props, 2); @@ -299,7 +299,7 @@ static PHP_METHOD(MongoDB_BSON_Javascript, __serialize) { PHONGO_PARSE_PARAMETERS_NONE(); - RETURN_ARR(php_phongo_javascript_get_properties_hash(PHONGO_COMPAT_OBJ_P(getThis()), true)); + RETURN_ARR(php_phongo_javascript_get_properties_hash(Z_OBJ_P(getThis()), true)); } static PHP_METHOD(MongoDB_BSON_Javascript, __unserialize) @@ -348,14 +348,14 @@ zend_object* php_phongo_javascript_create_object(zend_class_entry* class_type) return &intern->std; } -static zend_object* php_phongo_javascript_clone_object(phongo_compat_object_handler_type* object) +static zend_object* php_phongo_javascript_clone_object(zend_object* object) { php_phongo_javascript_t* intern; php_phongo_javascript_t* new_intern; zend_object* new_object; - intern = Z_OBJ_JAVASCRIPT(PHONGO_COMPAT_GET_OBJ(object)); - new_object = php_phongo_javascript_create_object(PHONGO_COMPAT_GET_OBJ(object)->ce); + intern = Z_OBJ_JAVASCRIPT(object); + new_object = php_phongo_javascript_create_object(object->ce); new_intern = Z_OBJ_JAVASCRIPT(new_object); zend_objects_clone_members(&new_intern->std, &intern->std); @@ -379,28 +379,24 @@ static int php_phongo_javascript_compare_objects(zval* o1, zval* o2) return strcmp(intern1->code, intern2->code); } -static HashTable* php_phongo_javascript_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) +static HashTable* php_phongo_javascript_get_debug_info(zend_object* object, int* is_temp) { *is_temp = 1; return php_phongo_javascript_get_properties_hash(object, true); } -static HashTable* php_phongo_javascript_get_properties(phongo_compat_object_handler_type* object) +static HashTable* php_phongo_javascript_get_properties(zend_object* object) { return php_phongo_javascript_get_properties_hash(object, false); } void php_phongo_javascript_init_ce(INIT_FUNC_ARGS) { - php_phongo_javascript_ce = register_class_MongoDB_BSON_Javascript(php_phongo_javascript_interface_ce, php_phongo_json_serializable_ce, php_phongo_type_ce, zend_ce_serializable); + php_phongo_javascript_ce = register_class_MongoDB_BSON_Javascript(php_phongo_javascript_interface_ce, php_phongo_json_serializable_ce, php_phongo_type_ce, zend_ce_serializable, zend_ce_stringable); php_phongo_javascript_ce->create_object = php_phongo_javascript_create_object; -#if PHP_VERSION_ID >= 80000 - zend_class_implements(php_phongo_javascript_ce, 1, zend_ce_stringable); -#endif - memcpy(&php_phongo_handler_javascript, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); - PHONGO_COMPAT_SET_COMPARE_OBJECTS_HANDLER(javascript); + php_phongo_handler_javascript.compare = php_phongo_javascript_compare_objects; php_phongo_handler_javascript.clone_obj = php_phongo_javascript_clone_object; php_phongo_handler_javascript.get_debug_info = php_phongo_javascript_get_debug_info; php_phongo_handler_javascript.get_properties = php_phongo_javascript_get_properties; diff --git a/src/BSON/Javascript.stub.php b/src/BSON/Javascript.stub.php index 2e27c1452..90b358eba 100644 --- a/src/BSON/Javascript.stub.php +++ b/src/BSON/Javascript.stub.php @@ -7,14 +7,9 @@ namespace MongoDB\BSON; -final class Javascript implements JavascriptInterface, \JsonSerializable, Type, \Serializable +final class Javascript implements JavascriptInterface, \JsonSerializable, Type, \Serializable, \Stringable { -#if PHP_VERSION_ID >= 80000 final public function __construct(string $code, array|object|null $scope = null) {} -#else - /** @param array|object|null $scope */ - final public function __construct(string $code, $scope = null) {} -#endif final public static function __set_state(array $properties): Javascript {} @@ -26,21 +21,11 @@ final public function __toString(): string {} final public function serialize(): string {} -#if PHP_VERSION_ID >= 80000 final public function unserialize(string $data): void {} -#else - /** @param string $serialized */ - final public function unserialize($serialized): void {} -#endif final public function __unserialize(array $data): void {} final public function __serialize(): array {} -#if PHP_VERSION_ID >= 80000 final public function jsonSerialize(): mixed {} -#else - /** @return mixed */ - final public function jsonSerialize() {} -#endif } diff --git a/src/BSON/Javascript_arginfo.h b/src/BSON/Javascript_arginfo.h index e4159c8b3..e14f8747d 100644 --- a/src/BSON/Javascript_arginfo.h +++ b/src/BSON/Javascript_arginfo.h @@ -1,19 +1,10 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 0ab7273525fae116007a65f91a92f6fbb80a6534 */ + * Stub hash: ca211f93a2f8cb801527ed7a3f4b6c434d879370 */ -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Javascript___construct, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, code, IS_STRING, 0) ZEND_ARG_TYPE_MASK(0, scope, MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_NULL, "null") ZEND_END_ARG_INFO() -#endif - -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Javascript___construct, 0, 0, 1) - ZEND_ARG_TYPE_INFO(0, code, IS_STRING, 0) - ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, scope, "null") -ZEND_END_ARG_INFO() -#endif ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_BSON_Javascript___set_state, 0, 1, MongoDB\\BSON\\Javascript, 0) ZEND_ARG_TYPE_INFO(0, properties, IS_ARRAY, 0) @@ -29,17 +20,9 @@ ZEND_END_ARG_INFO() #define arginfo_class_MongoDB_BSON_Javascript_serialize arginfo_class_MongoDB_BSON_Javascript_getCode -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Javascript_unserialize, 0, 1, IS_VOID, 0) ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0) ZEND_END_ARG_INFO() -#endif - -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Javascript_unserialize, 0, 1, IS_VOID, 0) - ZEND_ARG_INFO(0, serialized) -ZEND_END_ARG_INFO() -#endif ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Javascript___unserialize, 0, 1, IS_VOID, 0) ZEND_ARG_TYPE_INFO(0, data, IS_ARRAY, 0) @@ -48,81 +31,44 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Javascript___serialize, 0, 0, IS_ARRAY, 0) ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Javascript_jsonSerialize, 0, 0, IS_MIXED, 0) ZEND_END_ARG_INFO() -#endif -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Javascript_jsonSerialize, 0, 0, 0) -ZEND_END_ARG_INFO() -#endif - -#if PHP_VERSION_ID >= 80000 -static ZEND_METHOD(MongoDB_BSON_Javascript, __construct); -#endif -#if !(PHP_VERSION_ID >= 80000) static ZEND_METHOD(MongoDB_BSON_Javascript, __construct); -#endif static ZEND_METHOD(MongoDB_BSON_Javascript, __set_state); static ZEND_METHOD(MongoDB_BSON_Javascript, getCode); static ZEND_METHOD(MongoDB_BSON_Javascript, getScope); static ZEND_METHOD(MongoDB_BSON_Javascript, __toString); static ZEND_METHOD(MongoDB_BSON_Javascript, serialize); -#if PHP_VERSION_ID >= 80000 static ZEND_METHOD(MongoDB_BSON_Javascript, unserialize); -#endif -#if !(PHP_VERSION_ID >= 80000) -static ZEND_METHOD(MongoDB_BSON_Javascript, unserialize); -#endif static ZEND_METHOD(MongoDB_BSON_Javascript, __unserialize); static ZEND_METHOD(MongoDB_BSON_Javascript, __serialize); -#if PHP_VERSION_ID >= 80000 -static ZEND_METHOD(MongoDB_BSON_Javascript, jsonSerialize); -#endif -#if !(PHP_VERSION_ID >= 80000) static ZEND_METHOD(MongoDB_BSON_Javascript, jsonSerialize); -#endif static const zend_function_entry class_MongoDB_BSON_Javascript_methods[] = { -#if PHP_VERSION_ID >= 80000 ZEND_ME(MongoDB_BSON_Javascript, __construct, arginfo_class_MongoDB_BSON_Javascript___construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if !(PHP_VERSION_ID >= 80000) - ZEND_ME(MongoDB_BSON_Javascript, __construct, arginfo_class_MongoDB_BSON_Javascript___construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif ZEND_ME(MongoDB_BSON_Javascript, __set_state, arginfo_class_MongoDB_BSON_Javascript___set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_BSON_Javascript, getCode, arginfo_class_MongoDB_BSON_Javascript_getCode, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_BSON_Javascript, getScope, arginfo_class_MongoDB_BSON_Javascript_getScope, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_BSON_Javascript, __toString, arginfo_class_MongoDB_BSON_Javascript___toString, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_BSON_Javascript, serialize, arginfo_class_MongoDB_BSON_Javascript_serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#if PHP_VERSION_ID >= 80000 - ZEND_ME(MongoDB_BSON_Javascript, unserialize, arginfo_class_MongoDB_BSON_Javascript_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if !(PHP_VERSION_ID >= 80000) ZEND_ME(MongoDB_BSON_Javascript, unserialize, arginfo_class_MongoDB_BSON_Javascript_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif ZEND_ME(MongoDB_BSON_Javascript, __unserialize, arginfo_class_MongoDB_BSON_Javascript___unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_BSON_Javascript, __serialize, arginfo_class_MongoDB_BSON_Javascript___serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#if PHP_VERSION_ID >= 80000 - ZEND_ME(MongoDB_BSON_Javascript, jsonSerialize, arginfo_class_MongoDB_BSON_Javascript_jsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if !(PHP_VERSION_ID >= 80000) ZEND_ME(MongoDB_BSON_Javascript, jsonSerialize, arginfo_class_MongoDB_BSON_Javascript_jsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif ZEND_FE_END }; -static zend_class_entry *register_class_MongoDB_BSON_Javascript(zend_class_entry *class_entry_MongoDB_BSON_JavascriptInterface, zend_class_entry *class_entry_JsonSerializable, zend_class_entry *class_entry_MongoDB_BSON_Type, zend_class_entry *class_entry_Serializable) +static zend_class_entry *register_class_MongoDB_BSON_Javascript(zend_class_entry *class_entry_MongoDB_BSON_JavascriptInterface, zend_class_entry *class_entry_JsonSerializable, zend_class_entry *class_entry_MongoDB_BSON_Type, zend_class_entry *class_entry_Serializable, zend_class_entry *class_entry_Stringable) { zend_class_entry ce, *class_entry; INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Javascript", class_MongoDB_BSON_Javascript_methods); class_entry = zend_register_internal_class_ex(&ce, NULL); class_entry->ce_flags |= ZEND_ACC_FINAL; - zend_class_implements(class_entry, 4, class_entry_MongoDB_BSON_JavascriptInterface, class_entry_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable); + zend_class_implements(class_entry, 5, class_entry_MongoDB_BSON_JavascriptInterface, class_entry_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable, class_entry_Stringable); return class_entry; } diff --git a/src/BSON/MaxKey.stub.php b/src/BSON/MaxKey.stub.php index 18e6d1c06..95875b8c9 100644 --- a/src/BSON/MaxKey.stub.php +++ b/src/BSON/MaxKey.stub.php @@ -13,21 +13,11 @@ final public static function __set_state(array $properties): MaxKey {} final public function serialize(): string {} -#if PHP_VERSION_ID >= 80000 final public function unserialize(string $data): void {} -#else - /** @param string $serialized */ - final public function unserialize($serialized): void {} -#endif final public function __unserialize(array $data): void {} final public function __serialize(): array {} -#if PHP_VERSION_ID >= 80000 final public function jsonSerialize(): mixed {} -#else - /** @return mixed */ - final public function jsonSerialize() {} -#endif } diff --git a/src/BSON/MaxKey_arginfo.h b/src/BSON/MaxKey_arginfo.h index 01532c619..0b9667c66 100644 --- a/src/BSON/MaxKey_arginfo.h +++ b/src/BSON/MaxKey_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 619fb546b185f6ca1019829cf031e2a9e51c8f46 */ + * Stub hash: d397817e708c2633223aa7b6a7273c0a1a4feb1d */ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_BSON_MaxKey___set_state, 0, 1, MongoDB\\BSON\\MaxKey, 0) ZEND_ARG_TYPE_INFO(0, properties, IS_ARRAY, 0) @@ -8,17 +8,9 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_MaxKey_serialize, 0, 0, IS_STRING, 0) ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_MaxKey_unserialize, 0, 1, IS_VOID, 0) ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0) ZEND_END_ARG_INFO() -#endif - -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_MaxKey_unserialize, 0, 1, IS_VOID, 0) - ZEND_ARG_INFO(0, serialized) -ZEND_END_ARG_INFO() -#endif ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_MaxKey___unserialize, 0, 1, IS_VOID, 0) ZEND_ARG_TYPE_INFO(0, data, IS_ARRAY, 0) @@ -27,52 +19,25 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_MaxKey___serialize, 0, 0, IS_ARRAY, 0) ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_MaxKey_jsonSerialize, 0, 0, IS_MIXED, 0) ZEND_END_ARG_INFO() -#endif - -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_MaxKey_jsonSerialize, 0, 0, 0) -ZEND_END_ARG_INFO() -#endif static ZEND_METHOD(MongoDB_BSON_MaxKey, __set_state); static ZEND_METHOD(MongoDB_BSON_MaxKey, serialize); -#if PHP_VERSION_ID >= 80000 static ZEND_METHOD(MongoDB_BSON_MaxKey, unserialize); -#endif -#if !(PHP_VERSION_ID >= 80000) -static ZEND_METHOD(MongoDB_BSON_MaxKey, unserialize); -#endif static ZEND_METHOD(MongoDB_BSON_MaxKey, __unserialize); static ZEND_METHOD(MongoDB_BSON_MaxKey, __serialize); -#if PHP_VERSION_ID >= 80000 -static ZEND_METHOD(MongoDB_BSON_MaxKey, jsonSerialize); -#endif -#if !(PHP_VERSION_ID >= 80000) static ZEND_METHOD(MongoDB_BSON_MaxKey, jsonSerialize); -#endif static const zend_function_entry class_MongoDB_BSON_MaxKey_methods[] = { ZEND_ME(MongoDB_BSON_MaxKey, __set_state, arginfo_class_MongoDB_BSON_MaxKey___set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_BSON_MaxKey, serialize, arginfo_class_MongoDB_BSON_MaxKey_serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#if PHP_VERSION_ID >= 80000 ZEND_ME(MongoDB_BSON_MaxKey, unserialize, arginfo_class_MongoDB_BSON_MaxKey_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if !(PHP_VERSION_ID >= 80000) - ZEND_ME(MongoDB_BSON_MaxKey, unserialize, arginfo_class_MongoDB_BSON_MaxKey_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif ZEND_ME(MongoDB_BSON_MaxKey, __unserialize, arginfo_class_MongoDB_BSON_MaxKey___unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_BSON_MaxKey, __serialize, arginfo_class_MongoDB_BSON_MaxKey___serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#if PHP_VERSION_ID >= 80000 - ZEND_ME(MongoDB_BSON_MaxKey, jsonSerialize, arginfo_class_MongoDB_BSON_MaxKey_jsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if !(PHP_VERSION_ID >= 80000) ZEND_ME(MongoDB_BSON_MaxKey, jsonSerialize, arginfo_class_MongoDB_BSON_MaxKey_jsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif ZEND_FE_END }; diff --git a/src/BSON/MinKey.stub.php b/src/BSON/MinKey.stub.php index 8c0ec72b3..e12122706 100644 --- a/src/BSON/MinKey.stub.php +++ b/src/BSON/MinKey.stub.php @@ -13,21 +13,11 @@ final public static function __set_state(array $properties): MinKey {} final public function serialize(): string {} -#if PHP_VERSION_ID >= 80000 final public function unserialize(string $data): void {} -#else - /** @param string $serialized */ - final public function unserialize($serialized): void {} -#endif final public function __unserialize(array $data): void {} final public function __serialize(): array {} -#if PHP_VERSION_ID >= 80000 final public function jsonSerialize(): mixed {} -#else - /** @return mixed */ - final public function jsonSerialize() {} -#endif } diff --git a/src/BSON/MinKey_arginfo.h b/src/BSON/MinKey_arginfo.h index 1d55e64d2..c3aef6ac0 100644 --- a/src/BSON/MinKey_arginfo.h +++ b/src/BSON/MinKey_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 9557766098ca988ffae1c30a0ccf46258f1f6621 */ + * Stub hash: faf0e180715b7673158c3230cc109a93124cf4a9 */ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_BSON_MinKey___set_state, 0, 1, MongoDB\\BSON\\MinKey, 0) ZEND_ARG_TYPE_INFO(0, properties, IS_ARRAY, 0) @@ -8,17 +8,9 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_MinKey_serialize, 0, 0, IS_STRING, 0) ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_MinKey_unserialize, 0, 1, IS_VOID, 0) ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0) ZEND_END_ARG_INFO() -#endif - -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_MinKey_unserialize, 0, 1, IS_VOID, 0) - ZEND_ARG_INFO(0, serialized) -ZEND_END_ARG_INFO() -#endif ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_MinKey___unserialize, 0, 1, IS_VOID, 0) ZEND_ARG_TYPE_INFO(0, data, IS_ARRAY, 0) @@ -27,52 +19,25 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_MinKey___serialize, 0, 0, IS_ARRAY, 0) ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_MinKey_jsonSerialize, 0, 0, IS_MIXED, 0) ZEND_END_ARG_INFO() -#endif - -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_MinKey_jsonSerialize, 0, 0, 0) -ZEND_END_ARG_INFO() -#endif static ZEND_METHOD(MongoDB_BSON_MinKey, __set_state); static ZEND_METHOD(MongoDB_BSON_MinKey, serialize); -#if PHP_VERSION_ID >= 80000 static ZEND_METHOD(MongoDB_BSON_MinKey, unserialize); -#endif -#if !(PHP_VERSION_ID >= 80000) -static ZEND_METHOD(MongoDB_BSON_MinKey, unserialize); -#endif static ZEND_METHOD(MongoDB_BSON_MinKey, __unserialize); static ZEND_METHOD(MongoDB_BSON_MinKey, __serialize); -#if PHP_VERSION_ID >= 80000 -static ZEND_METHOD(MongoDB_BSON_MinKey, jsonSerialize); -#endif -#if !(PHP_VERSION_ID >= 80000) static ZEND_METHOD(MongoDB_BSON_MinKey, jsonSerialize); -#endif static const zend_function_entry class_MongoDB_BSON_MinKey_methods[] = { ZEND_ME(MongoDB_BSON_MinKey, __set_state, arginfo_class_MongoDB_BSON_MinKey___set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_BSON_MinKey, serialize, arginfo_class_MongoDB_BSON_MinKey_serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#if PHP_VERSION_ID >= 80000 ZEND_ME(MongoDB_BSON_MinKey, unserialize, arginfo_class_MongoDB_BSON_MinKey_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if !(PHP_VERSION_ID >= 80000) - ZEND_ME(MongoDB_BSON_MinKey, unserialize, arginfo_class_MongoDB_BSON_MinKey_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif ZEND_ME(MongoDB_BSON_MinKey, __unserialize, arginfo_class_MongoDB_BSON_MinKey___unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_BSON_MinKey, __serialize, arginfo_class_MongoDB_BSON_MinKey___serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#if PHP_VERSION_ID >= 80000 - ZEND_ME(MongoDB_BSON_MinKey, jsonSerialize, arginfo_class_MongoDB_BSON_MinKey_jsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if !(PHP_VERSION_ID >= 80000) ZEND_ME(MongoDB_BSON_MinKey, jsonSerialize, arginfo_class_MongoDB_BSON_MinKey_jsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif ZEND_FE_END }; diff --git a/src/BSON/ObjectId.c b/src/BSON/ObjectId.c index 162dccbf6..cca84e832 100644 --- a/src/BSON/ObjectId.c +++ b/src/BSON/ObjectId.c @@ -79,12 +79,12 @@ static bool php_phongo_objectid_init_from_hash(php_phongo_objectid_t* intern, Ha return false; } -static HashTable* php_phongo_objectid_get_properties_hash(phongo_compat_object_handler_type* object, bool is_temp) +static HashTable* php_phongo_objectid_get_properties_hash(zend_object* object, bool is_temp) { php_phongo_objectid_t* intern; HashTable* props; - intern = Z_OBJ_OBJECTID(PHONGO_COMPAT_GET_OBJ(object)); + intern = Z_OBJ_OBJECTID(object); PHONGO_GET_PROPERTY_HASH_INIT_PROPS(is_temp, intern, props, 1); @@ -234,7 +234,7 @@ static PHP_METHOD(MongoDB_BSON_ObjectId, __serialize) { PHONGO_PARSE_PARAMETERS_NONE(); - RETURN_ARR(php_phongo_objectid_get_properties_hash(PHONGO_COMPAT_OBJ_P(getThis()), true)); + RETURN_ARR(php_phongo_objectid_get_properties_hash(Z_OBJ_P(getThis()), true)); } static PHP_METHOD(MongoDB_BSON_ObjectId, __unserialize) @@ -275,14 +275,14 @@ static zend_object* php_phongo_objectid_create_object(zend_class_entry* class_ty return &intern->std; } -static zend_object* php_phongo_objectid_clone_object(phongo_compat_object_handler_type* object) +static zend_object* php_phongo_objectid_clone_object(zend_object* object) { php_phongo_objectid_t* intern; php_phongo_objectid_t* new_intern; zend_object* new_object; - intern = Z_OBJ_OBJECTID(PHONGO_COMPAT_GET_OBJ(object)); - new_object = php_phongo_objectid_create_object(PHONGO_COMPAT_GET_OBJ(object)->ce); + intern = Z_OBJ_OBJECTID(object); + new_object = php_phongo_objectid_create_object(object->ce); new_intern = Z_OBJ_OBJECTID(new_object); zend_objects_clone_members(&new_intern->std, &intern->std); @@ -307,28 +307,24 @@ static int php_phongo_objectid_compare_objects(zval* o1, zval* o2) return strcmp(intern1->oid, intern2->oid); } -static HashTable* php_phongo_objectid_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) +static HashTable* php_phongo_objectid_get_debug_info(zend_object* object, int* is_temp) { *is_temp = 1; return php_phongo_objectid_get_properties_hash(object, true); } -static HashTable* php_phongo_objectid_get_properties(phongo_compat_object_handler_type* object) +static HashTable* php_phongo_objectid_get_properties(zend_object* object) { return php_phongo_objectid_get_properties_hash(object, false); } void php_phongo_objectid_init_ce(INIT_FUNC_ARGS) { - php_phongo_objectid_ce = register_class_MongoDB_BSON_ObjectId(php_phongo_objectid_interface_ce, php_phongo_json_serializable_ce, php_phongo_type_ce, zend_ce_serializable); + php_phongo_objectid_ce = register_class_MongoDB_BSON_ObjectId(php_phongo_objectid_interface_ce, php_phongo_json_serializable_ce, php_phongo_type_ce, zend_ce_serializable, zend_ce_stringable); php_phongo_objectid_ce->create_object = php_phongo_objectid_create_object; -#if PHP_VERSION_ID >= 80000 - zend_class_implements(php_phongo_objectid_ce, 1, zend_ce_stringable); -#endif - memcpy(&php_phongo_handler_objectid, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); - PHONGO_COMPAT_SET_COMPARE_OBJECTS_HANDLER(objectid); + php_phongo_handler_objectid.compare = php_phongo_objectid_compare_objects; php_phongo_handler_objectid.clone_obj = php_phongo_objectid_clone_object; php_phongo_handler_objectid.get_debug_info = php_phongo_objectid_get_debug_info; php_phongo_handler_objectid.get_properties = php_phongo_objectid_get_properties; diff --git a/src/BSON/ObjectId.stub.php b/src/BSON/ObjectId.stub.php index 86aa0148b..1b873c5e0 100644 --- a/src/BSON/ObjectId.stub.php +++ b/src/BSON/ObjectId.stub.php @@ -7,7 +7,7 @@ namespace MongoDB\BSON; -final class ObjectId implements ObjectIdInterface, \JsonSerializable, Type, \Serializable +final class ObjectId implements ObjectIdInterface, \JsonSerializable, Type, \Serializable, \Stringable { final public function __construct(?string $id = null) {} @@ -19,21 +19,11 @@ final public static function __set_state(array $properties): ObjectId {} final public function serialize(): string {} -#if PHP_VERSION_ID >= 80000 final public function unserialize(string $data): void {} -#else - /** @param string $serialized */ - final public function unserialize($serialized): void {} -#endif final public function __unserialize(array $data): void {} final public function __serialize(): array {} -#if PHP_VERSION_ID >= 80000 final public function jsonSerialize(): mixed {} -#else - /** @return mixed */ - final public function jsonSerialize() {} -#endif } diff --git a/src/BSON/ObjectId_arginfo.h b/src/BSON/ObjectId_arginfo.h index cedeac146..a4184611e 100644 --- a/src/BSON/ObjectId_arginfo.h +++ b/src/BSON/ObjectId_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: bb3d1616e135d65abe0a645a1746ef0afd27c82e */ + * Stub hash: 22bff62df5f5363fbb44eabf77225e1b765be73f */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_ObjectId___construct, 0, 0, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, id, IS_STRING, 1, "null") @@ -17,17 +17,9 @@ ZEND_END_ARG_INFO() #define arginfo_class_MongoDB_BSON_ObjectId_serialize arginfo_class_MongoDB_BSON_ObjectId___toString -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_ObjectId_unserialize, 0, 1, IS_VOID, 0) ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0) ZEND_END_ARG_INFO() -#endif - -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_ObjectId_unserialize, 0, 1, IS_VOID, 0) - ZEND_ARG_INFO(0, serialized) -ZEND_END_ARG_INFO() -#endif ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_ObjectId___unserialize, 0, 1, IS_VOID, 0) ZEND_ARG_TYPE_INFO(0, data, IS_ARRAY, 0) @@ -36,15 +28,8 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_ObjectId___serialize, 0, 0, IS_ARRAY, 0) ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_ObjectId_jsonSerialize, 0, 0, IS_MIXED, 0) ZEND_END_ARG_INFO() -#endif - -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_ObjectId_jsonSerialize, 0, 0, 0) -ZEND_END_ARG_INFO() -#endif static ZEND_METHOD(MongoDB_BSON_ObjectId, __construct); @@ -52,20 +37,10 @@ static ZEND_METHOD(MongoDB_BSON_ObjectId, getTimestamp); static ZEND_METHOD(MongoDB_BSON_ObjectId, __toString); static ZEND_METHOD(MongoDB_BSON_ObjectId, __set_state); static ZEND_METHOD(MongoDB_BSON_ObjectId, serialize); -#if PHP_VERSION_ID >= 80000 static ZEND_METHOD(MongoDB_BSON_ObjectId, unserialize); -#endif -#if !(PHP_VERSION_ID >= 80000) -static ZEND_METHOD(MongoDB_BSON_ObjectId, unserialize); -#endif static ZEND_METHOD(MongoDB_BSON_ObjectId, __unserialize); static ZEND_METHOD(MongoDB_BSON_ObjectId, __serialize); -#if PHP_VERSION_ID >= 80000 -static ZEND_METHOD(MongoDB_BSON_ObjectId, jsonSerialize); -#endif -#if !(PHP_VERSION_ID >= 80000) static ZEND_METHOD(MongoDB_BSON_ObjectId, jsonSerialize); -#endif static const zend_function_entry class_MongoDB_BSON_ObjectId_methods[] = { @@ -74,31 +49,21 @@ static const zend_function_entry class_MongoDB_BSON_ObjectId_methods[] = { ZEND_ME(MongoDB_BSON_ObjectId, __toString, arginfo_class_MongoDB_BSON_ObjectId___toString, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_BSON_ObjectId, __set_state, arginfo_class_MongoDB_BSON_ObjectId___set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_BSON_ObjectId, serialize, arginfo_class_MongoDB_BSON_ObjectId_serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#if PHP_VERSION_ID >= 80000 ZEND_ME(MongoDB_BSON_ObjectId, unserialize, arginfo_class_MongoDB_BSON_ObjectId_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if !(PHP_VERSION_ID >= 80000) - ZEND_ME(MongoDB_BSON_ObjectId, unserialize, arginfo_class_MongoDB_BSON_ObjectId_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif ZEND_ME(MongoDB_BSON_ObjectId, __unserialize, arginfo_class_MongoDB_BSON_ObjectId___unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_BSON_ObjectId, __serialize, arginfo_class_MongoDB_BSON_ObjectId___serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#if PHP_VERSION_ID >= 80000 - ZEND_ME(MongoDB_BSON_ObjectId, jsonSerialize, arginfo_class_MongoDB_BSON_ObjectId_jsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if !(PHP_VERSION_ID >= 80000) ZEND_ME(MongoDB_BSON_ObjectId, jsonSerialize, arginfo_class_MongoDB_BSON_ObjectId_jsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif ZEND_FE_END }; -static zend_class_entry *register_class_MongoDB_BSON_ObjectId(zend_class_entry *class_entry_MongoDB_BSON_ObjectIdInterface, zend_class_entry *class_entry_JsonSerializable, zend_class_entry *class_entry_MongoDB_BSON_Type, zend_class_entry *class_entry_Serializable) +static zend_class_entry *register_class_MongoDB_BSON_ObjectId(zend_class_entry *class_entry_MongoDB_BSON_ObjectIdInterface, zend_class_entry *class_entry_JsonSerializable, zend_class_entry *class_entry_MongoDB_BSON_Type, zend_class_entry *class_entry_Serializable, zend_class_entry *class_entry_Stringable) { zend_class_entry ce, *class_entry; INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "ObjectId", class_MongoDB_BSON_ObjectId_methods); class_entry = zend_register_internal_class_ex(&ce, NULL); class_entry->ce_flags |= ZEND_ACC_FINAL; - zend_class_implements(class_entry, 4, class_entry_MongoDB_BSON_ObjectIdInterface, class_entry_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable); + zend_class_implements(class_entry, 5, class_entry_MongoDB_BSON_ObjectIdInterface, class_entry_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable, class_entry_Stringable); return class_entry; } diff --git a/src/BSON/PackedArray.c b/src/BSON/PackedArray.c index ac9fb5b4f..6944f425b 100644 --- a/src/BSON/PackedArray.c +++ b/src/BSON/PackedArray.c @@ -58,12 +58,12 @@ static bool php_phongo_packedarray_init_from_hash(php_phongo_packedarray_t* inte return false; } -static HashTable* php_phongo_packedarray_get_properties_hash(phongo_compat_object_handler_type* object, bool is_temp, int size) +static HashTable* php_phongo_packedarray_get_properties_hash(zend_object* object, bool is_temp, int size) { php_phongo_packedarray_t* intern; HashTable* props; - intern = Z_OBJ_PACKEDARRAY(PHONGO_COMPAT_GET_OBJ(object)); + intern = Z_OBJ_PACKEDARRAY(object); PHONGO_GET_PROPERTY_HASH_INIT_PROPS(is_temp, intern, props, size); @@ -362,7 +362,7 @@ static PHP_METHOD(MongoDB_BSON_PackedArray, __serialize) { PHONGO_PARSE_PARAMETERS_NONE(); - RETURN_ARR(php_phongo_packedarray_get_properties_hash(PHONGO_COMPAT_OBJ_P(getThis()), true, 1)); + RETURN_ARR(php_phongo_packedarray_get_properties_hash(Z_OBJ_P(getThis()), true, 1)); } static PHP_METHOD(MongoDB_BSON_PackedArray, __unserialize) @@ -407,14 +407,14 @@ static zend_object* php_phongo_packedarray_create_object(zend_class_entry* class return &intern->std; } -static zend_object* php_phongo_packedarray_clone_object(phongo_compat_object_handler_type* object) +static zend_object* php_phongo_packedarray_clone_object(zend_object* object) { php_phongo_packedarray_t* intern; php_phongo_packedarray_t* new_intern; zend_object* new_object; - intern = Z_OBJ_PACKEDARRAY(PHONGO_COMPAT_GET_OBJ(object)); - new_object = php_phongo_packedarray_create_object(PHONGO_COMPAT_GET_OBJ(object)->ce); + intern = Z_OBJ_PACKEDARRAY(object); + new_object = php_phongo_packedarray_create_object(object->ce); new_intern = Z_OBJ_PACKEDARRAY(new_object); zend_objects_clone_members(&new_intern->std, &intern->std); @@ -436,13 +436,13 @@ static int php_phongo_packedarray_compare_objects(zval* o1, zval* o2) return bson_compare(intern1->bson, intern2->bson); } -static HashTable* php_phongo_packedarray_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) +static HashTable* php_phongo_packedarray_get_debug_info(zend_object* object, int* is_temp) { php_phongo_packedarray_t* intern; HashTable* props; *is_temp = 1; - intern = Z_OBJ_PACKEDARRAY(PHONGO_COMPAT_GET_OBJ(object)); + intern = Z_OBJ_PACKEDARRAY(object); /* This get_debug_info handler reports an additional property. This does not * conflict with other uses of php_phongo_document_get_properties_hash since @@ -471,16 +471,16 @@ static HashTable* php_phongo_packedarray_get_debug_info(phongo_compat_object_han return NULL; } -static HashTable* php_phongo_packedarray_get_properties(phongo_compat_object_handler_type* object) +static HashTable* php_phongo_packedarray_get_properties(zend_object* object) { return php_phongo_packedarray_get_properties_hash(object, false, 1); } -zval* php_phongo_packedarray_read_dimension(phongo_compat_object_handler_type* object, zval* offset, int type, zval* rv) +zval* php_phongo_packedarray_read_dimension(zend_object* object, zval* offset, int type, zval* rv) { php_phongo_packedarray_t* intern; - intern = Z_OBJ_PACKEDARRAY(PHONGO_COMPAT_GET_OBJ(object)); + intern = Z_OBJ_PACKEDARRAY(object); if (Z_TYPE_P(offset) != IS_LONG) { if (type == BP_VAR_IS) { @@ -500,16 +500,16 @@ zval* php_phongo_packedarray_read_dimension(phongo_compat_object_handler_type* o return rv; } -void php_phongo_packedarray_write_dimension(phongo_compat_object_handler_type* object, zval* offset, zval* value) +void php_phongo_packedarray_write_dimension(zend_object* object, zval* offset, zval* value) { phongo_throw_exception(PHONGO_ERROR_LOGIC, "Cannot write to %s offset", ZSTR_VAL(php_phongo_packedarray_ce->name)); } -int php_phongo_packedarray_has_dimension(phongo_compat_object_handler_type* object, zval* member, int check_empty) +int php_phongo_packedarray_has_dimension(zend_object* object, zval* member, int check_empty) { php_phongo_packedarray_t* intern; - intern = Z_OBJ_PACKEDARRAY(PHONGO_COMPAT_GET_OBJ(object)); + intern = Z_OBJ_PACKEDARRAY(object); if (Z_TYPE_P(member) != IS_LONG) { return false; @@ -518,22 +518,18 @@ int php_phongo_packedarray_has_dimension(phongo_compat_object_handler_type* obje return php_phongo_packedarray_has(intern, Z_LVAL_P(member)); } -void php_phongo_packedarray_unset_dimension(phongo_compat_object_handler_type* object, zval* offset) +void php_phongo_packedarray_unset_dimension(zend_object* object, zval* offset) { phongo_throw_exception(PHONGO_ERROR_LOGIC, "Cannot unset %s offset", ZSTR_VAL(php_phongo_packedarray_ce->name)); } void php_phongo_packedarray_init_ce(INIT_FUNC_ARGS) { - php_phongo_packedarray_ce = register_class_MongoDB_BSON_PackedArray(zend_ce_aggregate, zend_ce_serializable, zend_ce_arrayaccess, php_phongo_type_ce); + php_phongo_packedarray_ce = register_class_MongoDB_BSON_PackedArray(zend_ce_aggregate, zend_ce_serializable, zend_ce_arrayaccess, php_phongo_type_ce, zend_ce_stringable); php_phongo_packedarray_ce->create_object = php_phongo_packedarray_create_object; -#if PHP_VERSION_ID >= 80000 - zend_class_implements(php_phongo_packedarray_ce, 1, zend_ce_stringable); -#endif - memcpy(&php_phongo_handler_packedarray, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); - PHONGO_COMPAT_SET_COMPARE_OBJECTS_HANDLER(packedarray); + php_phongo_handler_packedarray.compare = php_phongo_packedarray_compare_objects; php_phongo_handler_packedarray.clone_obj = php_phongo_packedarray_clone_object; php_phongo_handler_packedarray.get_debug_info = php_phongo_packedarray_get_debug_info; php_phongo_handler_packedarray.get_properties = php_phongo_packedarray_get_properties; diff --git a/src/BSON/PackedArray.stub.php b/src/BSON/PackedArray.stub.php index bb9f36097..dc5cecc0c 100644 --- a/src/BSON/PackedArray.stub.php +++ b/src/BSON/PackedArray.stub.php @@ -7,63 +7,27 @@ namespace MongoDB\BSON; -final class PackedArray implements \IteratorAggregate, \Serializable, \ArrayAccess, Type +final class PackedArray implements \IteratorAggregate, \Serializable, \ArrayAccess, Type, \Stringable { private function __construct() {} final static public function fromPHP(array $value): PackedArray {} -#if PHP_VERSION_ID >= 80000 final public function get(int $index): mixed {} -#else - /** @return mixed */ - final public function get(int $index) {} -#endif final public function getIterator(): Iterator {} final public function has(int $index): bool {} -#if PHP_VERSION_ID >= 80000 final public function toPHP(?array $typeMap = null): array|object {} -#else - /** @return array|object */ - final public function toPHP(?array $typeMap = null) {} -#endif -#if PHP_VERSION_ID >= 80000 public function offsetExists(mixed $offset): bool {} -# else - /** @param mixed $offset */ - public function offsetExists($offset): bool {} -# endif -#if PHP_VERSION_ID >= 80000 public function offsetGet(mixed $offset): mixed {} -# else - /** - * @param mixed $offset - * @return mixed - */ - public function offsetGet($offset) {} -# endif - -#if PHP_VERSION_ID >= 80000 + public function offsetSet(mixed $offset, mixed $value): void {} -# else - /** - * @param mixed $offset - * @param mixed $value - */ - public function offsetSet($offset, $value): void {} -# endif - -#if PHP_VERSION_ID >= 80000 + public function offsetUnset(mixed $offset): void {} -# else - /** @param mixed $offset */ - public function offsetUnset($offset): void {} -# endif final public function __toString(): string {} @@ -71,12 +35,7 @@ final public static function __set_state(array $properties): PackedArray {} final public function serialize(): string {} -#if PHP_VERSION_ID >= 80000 final public function unserialize(string $data): void {} -#else - /** @param string $serialized */ - final public function unserialize($serialized): void {} -#endif final public function __unserialize(array $data): void {} diff --git a/src/BSON/PackedArray_arginfo.h b/src/BSON/PackedArray_arginfo.h index 7d9e2c374..c26df9ba5 100644 --- a/src/BSON/PackedArray_arginfo.h +++ b/src/BSON/PackedArray_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: db49af73e3b8ef35fa6ed70fd8c097e0de69f17e */ + * Stub hash: 4abc68e50d88ce5774c727137878697123f0ac32 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_PackedArray___construct, 0, 0, 0) ZEND_END_ARG_INFO() @@ -8,17 +8,9 @@ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_BSON_PackedArray_fr ZEND_ARG_TYPE_INFO(0, value, IS_ARRAY, 0) ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_PackedArray_get, 0, 1, IS_MIXED, 0) ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0) ZEND_END_ARG_INFO() -#endif - -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_PackedArray_get, 0, 0, 1) - ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0) -ZEND_END_ARG_INFO() -#endif ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_BSON_PackedArray_getIterator, 0, 0, MongoDB\\BSON\\Iterator, 0) ZEND_END_ARG_INFO() @@ -27,67 +19,26 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_PackedArray_h ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0) ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_class_MongoDB_BSON_PackedArray_toPHP, 0, 0, MAY_BE_ARRAY|MAY_BE_OBJECT) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, typeMap, IS_ARRAY, 1, "null") ZEND_END_ARG_INFO() -#endif -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_PackedArray_toPHP, 0, 0, 0) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, typeMap, IS_ARRAY, 1, "null") -ZEND_END_ARG_INFO() -#endif - -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_PackedArray_offsetExists, 0, 1, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, offset, IS_MIXED, 0) ZEND_END_ARG_INFO() -#endif - -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_PackedArray_offsetExists, 0, 1, _IS_BOOL, 0) - ZEND_ARG_INFO(0, offset) -ZEND_END_ARG_INFO() -#endif -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_PackedArray_offsetGet, 0, 1, IS_MIXED, 0) ZEND_ARG_TYPE_INFO(0, offset, IS_MIXED, 0) ZEND_END_ARG_INFO() -#endif -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_PackedArray_offsetGet, 0, 0, 1) - ZEND_ARG_INFO(0, offset) -ZEND_END_ARG_INFO() -#endif - -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_PackedArray_offsetSet, 0, 2, IS_VOID, 0) ZEND_ARG_TYPE_INFO(0, offset, IS_MIXED, 0) ZEND_ARG_TYPE_INFO(0, value, IS_MIXED, 0) ZEND_END_ARG_INFO() -#endif - -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_PackedArray_offsetSet, 0, 2, IS_VOID, 0) - ZEND_ARG_INFO(0, offset) - ZEND_ARG_INFO(0, value) -ZEND_END_ARG_INFO() -#endif -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_PackedArray_offsetUnset, 0, 1, IS_VOID, 0) ZEND_ARG_TYPE_INFO(0, offset, IS_MIXED, 0) ZEND_END_ARG_INFO() -#endif - -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_PackedArray_offsetUnset, 0, 1, IS_VOID, 0) - ZEND_ARG_INFO(0, offset) -ZEND_END_ARG_INFO() -#endif ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_PackedArray___toString, 0, 0, IS_STRING, 0) ZEND_END_ARG_INFO() @@ -98,17 +49,9 @@ ZEND_END_ARG_INFO() #define arginfo_class_MongoDB_BSON_PackedArray_serialize arginfo_class_MongoDB_BSON_PackedArray___toString -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_PackedArray_unserialize, 0, 1, IS_VOID, 0) ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0) ZEND_END_ARG_INFO() -#endif - -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_PackedArray_unserialize, 0, 1, IS_VOID, 0) - ZEND_ARG_INFO(0, serialized) -ZEND_END_ARG_INFO() -#endif ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_PackedArray___unserialize, 0, 1, IS_VOID, 0) ZEND_ARG_TYPE_INFO(0, data, IS_ARRAY, 0) @@ -120,53 +63,18 @@ ZEND_END_ARG_INFO() static ZEND_METHOD(MongoDB_BSON_PackedArray, __construct); static ZEND_METHOD(MongoDB_BSON_PackedArray, fromPHP); -#if PHP_VERSION_ID >= 80000 static ZEND_METHOD(MongoDB_BSON_PackedArray, get); -#endif -#if !(PHP_VERSION_ID >= 80000) -static ZEND_METHOD(MongoDB_BSON_PackedArray, get); -#endif static ZEND_METHOD(MongoDB_BSON_PackedArray, getIterator); static ZEND_METHOD(MongoDB_BSON_PackedArray, has); -#if PHP_VERSION_ID >= 80000 -static ZEND_METHOD(MongoDB_BSON_PackedArray, toPHP); -#endif -#if !(PHP_VERSION_ID >= 80000) static ZEND_METHOD(MongoDB_BSON_PackedArray, toPHP); -#endif -#if PHP_VERSION_ID >= 80000 static ZEND_METHOD(MongoDB_BSON_PackedArray, offsetExists); -#endif -#if !(PHP_VERSION_ID >= 80000) -static ZEND_METHOD(MongoDB_BSON_PackedArray, offsetExists); -#endif -#if PHP_VERSION_ID >= 80000 -static ZEND_METHOD(MongoDB_BSON_PackedArray, offsetGet); -#endif -#if !(PHP_VERSION_ID >= 80000) static ZEND_METHOD(MongoDB_BSON_PackedArray, offsetGet); -#endif -#if PHP_VERSION_ID >= 80000 static ZEND_METHOD(MongoDB_BSON_PackedArray, offsetSet); -#endif -#if !(PHP_VERSION_ID >= 80000) -static ZEND_METHOD(MongoDB_BSON_PackedArray, offsetSet); -#endif -#if PHP_VERSION_ID >= 80000 -static ZEND_METHOD(MongoDB_BSON_PackedArray, offsetUnset); -#endif -#if !(PHP_VERSION_ID >= 80000) static ZEND_METHOD(MongoDB_BSON_PackedArray, offsetUnset); -#endif static ZEND_METHOD(MongoDB_BSON_PackedArray, __toString); static ZEND_METHOD(MongoDB_BSON_PackedArray, __set_state); static ZEND_METHOD(MongoDB_BSON_PackedArray, serialize); -#if PHP_VERSION_ID >= 80000 static ZEND_METHOD(MongoDB_BSON_PackedArray, unserialize); -#endif -#if !(PHP_VERSION_ID >= 80000) -static ZEND_METHOD(MongoDB_BSON_PackedArray, unserialize); -#endif static ZEND_METHOD(MongoDB_BSON_PackedArray, __unserialize); static ZEND_METHOD(MongoDB_BSON_PackedArray, __serialize); @@ -174,66 +82,31 @@ static ZEND_METHOD(MongoDB_BSON_PackedArray, __serialize); static const zend_function_entry class_MongoDB_BSON_PackedArray_methods[] = { ZEND_ME(MongoDB_BSON_PackedArray, __construct, arginfo_class_MongoDB_BSON_PackedArray___construct, ZEND_ACC_PRIVATE) ZEND_ME(MongoDB_BSON_PackedArray, fromPHP, arginfo_class_MongoDB_BSON_PackedArray_fromPHP, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL) -#if PHP_VERSION_ID >= 80000 - ZEND_ME(MongoDB_BSON_PackedArray, get, arginfo_class_MongoDB_BSON_PackedArray_get, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if !(PHP_VERSION_ID >= 80000) ZEND_ME(MongoDB_BSON_PackedArray, get, arginfo_class_MongoDB_BSON_PackedArray_get, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif ZEND_ME(MongoDB_BSON_PackedArray, getIterator, arginfo_class_MongoDB_BSON_PackedArray_getIterator, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_BSON_PackedArray, has, arginfo_class_MongoDB_BSON_PackedArray_has, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#if PHP_VERSION_ID >= 80000 ZEND_ME(MongoDB_BSON_PackedArray, toPHP, arginfo_class_MongoDB_BSON_PackedArray_toPHP, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if !(PHP_VERSION_ID >= 80000) - ZEND_ME(MongoDB_BSON_PackedArray, toPHP, arginfo_class_MongoDB_BSON_PackedArray_toPHP, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if PHP_VERSION_ID >= 80000 - ZEND_ME(MongoDB_BSON_PackedArray, offsetExists, arginfo_class_MongoDB_BSON_PackedArray_offsetExists, ZEND_ACC_PUBLIC) -#endif -#if !(PHP_VERSION_ID >= 80000) ZEND_ME(MongoDB_BSON_PackedArray, offsetExists, arginfo_class_MongoDB_BSON_PackedArray_offsetExists, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 ZEND_ME(MongoDB_BSON_PackedArray, offsetGet, arginfo_class_MongoDB_BSON_PackedArray_offsetGet, ZEND_ACC_PUBLIC) -#endif -#if !(PHP_VERSION_ID >= 80000) - ZEND_ME(MongoDB_BSON_PackedArray, offsetGet, arginfo_class_MongoDB_BSON_PackedArray_offsetGet, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - ZEND_ME(MongoDB_BSON_PackedArray, offsetSet, arginfo_class_MongoDB_BSON_PackedArray_offsetSet, ZEND_ACC_PUBLIC) -#endif -#if !(PHP_VERSION_ID >= 80000) ZEND_ME(MongoDB_BSON_PackedArray, offsetSet, arginfo_class_MongoDB_BSON_PackedArray_offsetSet, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 ZEND_ME(MongoDB_BSON_PackedArray, offsetUnset, arginfo_class_MongoDB_BSON_PackedArray_offsetUnset, ZEND_ACC_PUBLIC) -#endif -#if !(PHP_VERSION_ID >= 80000) - ZEND_ME(MongoDB_BSON_PackedArray, offsetUnset, arginfo_class_MongoDB_BSON_PackedArray_offsetUnset, ZEND_ACC_PUBLIC) -#endif ZEND_ME(MongoDB_BSON_PackedArray, __toString, arginfo_class_MongoDB_BSON_PackedArray___toString, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_BSON_PackedArray, __set_state, arginfo_class_MongoDB_BSON_PackedArray___set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_BSON_PackedArray, serialize, arginfo_class_MongoDB_BSON_PackedArray_serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#if PHP_VERSION_ID >= 80000 - ZEND_ME(MongoDB_BSON_PackedArray, unserialize, arginfo_class_MongoDB_BSON_PackedArray_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if !(PHP_VERSION_ID >= 80000) ZEND_ME(MongoDB_BSON_PackedArray, unserialize, arginfo_class_MongoDB_BSON_PackedArray_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif ZEND_ME(MongoDB_BSON_PackedArray, __unserialize, arginfo_class_MongoDB_BSON_PackedArray___unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_BSON_PackedArray, __serialize, arginfo_class_MongoDB_BSON_PackedArray___serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_FE_END }; -static zend_class_entry *register_class_MongoDB_BSON_PackedArray(zend_class_entry *class_entry_IteratorAggregate, zend_class_entry *class_entry_Serializable, zend_class_entry *class_entry_ArrayAccess, zend_class_entry *class_entry_MongoDB_BSON_Type) +static zend_class_entry *register_class_MongoDB_BSON_PackedArray(zend_class_entry *class_entry_IteratorAggregate, zend_class_entry *class_entry_Serializable, zend_class_entry *class_entry_ArrayAccess, zend_class_entry *class_entry_MongoDB_BSON_Type, zend_class_entry *class_entry_Stringable) { zend_class_entry ce, *class_entry; INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "PackedArray", class_MongoDB_BSON_PackedArray_methods); class_entry = zend_register_internal_class_ex(&ce, NULL); class_entry->ce_flags |= ZEND_ACC_FINAL; - zend_class_implements(class_entry, 4, class_entry_IteratorAggregate, class_entry_Serializable, class_entry_ArrayAccess, class_entry_MongoDB_BSON_Type); + zend_class_implements(class_entry, 5, class_entry_IteratorAggregate, class_entry_Serializable, class_entry_ArrayAccess, class_entry_MongoDB_BSON_Type, class_entry_Stringable); return class_entry; } diff --git a/src/BSON/Persistable.c b/src/BSON/Persistable.c index c47a3cc8c..c6cab6928 100644 --- a/src/BSON/Persistable.c +++ b/src/BSON/Persistable.c @@ -23,12 +23,10 @@ zend_class_entry* php_phongo_persistable_ce; static int php_phongo_implement_persistable(zend_class_entry* interface, zend_class_entry* class_type) { -#if PHP_VERSION_ID >= 80100 if (class_type->ce_flags & ZEND_ACC_ENUM) { zend_error_noreturn(E_ERROR, "Enum class %s cannot implement interface %s", ZSTR_VAL(class_type->name), ZSTR_VAL(interface->name)); return FAILURE; } -#endif /* PHP_VERSION_ID >= 80100 */ return SUCCESS; } diff --git a/src/BSON/Persistable.stub.php b/src/BSON/Persistable.stub.php index be81e032b..71d25c617 100644 --- a/src/BSON/Persistable.stub.php +++ b/src/BSON/Persistable.stub.php @@ -9,11 +9,6 @@ interface Persistable extends Serializable, Unserializable { -#if PHP_VERSION_ID >= 80000 /** @tentative-return-type */ public function bsonSerialize(): array|\stdClass|Document; -#else - /** @return array|\stdClass|Document */ - public function bsonSerialize(); -#endif } diff --git a/src/BSON/Persistable_arginfo.h b/src/BSON/Persistable_arginfo.h index 0c7048f2b..e82945bf8 100644 --- a/src/BSON/Persistable_arginfo.h +++ b/src/BSON/Persistable_arginfo.h @@ -1,30 +1,14 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: e61c06a90093af5468c6c29f6cbf16c5db8d54d1 */ + * Stub hash: ae3ff5f618e86293cdbee0ce419fee2b82c95ed6 */ -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_OBJ_TYPE_MASK_EX(arginfo_class_MongoDB_BSON_Persistable_bsonSerialize, 0, 0, stdClass|MongoDB\\BSON\\Document, MAY_BE_ARRAY) ZEND_END_ARG_INFO() -#endif - -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Persistable_bsonSerialize, 0, 0, 0) -ZEND_END_ARG_INFO() -#endif -#if PHP_VERSION_ID >= 80000 -#endif -#if !(PHP_VERSION_ID >= 80000) -#endif static const zend_function_entry class_MongoDB_BSON_Persistable_methods[] = { -#if PHP_VERSION_ID >= 80000 - ZEND_ABSTRACT_ME_WITH_FLAGS(MongoDB_BSON_Persistable, bsonSerialize, arginfo_class_MongoDB_BSON_Persistable_bsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT) -#endif -#if !(PHP_VERSION_ID >= 80000) ZEND_ABSTRACT_ME_WITH_FLAGS(MongoDB_BSON_Persistable, bsonSerialize, arginfo_class_MongoDB_BSON_Persistable_bsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT) -#endif ZEND_FE_END }; diff --git a/src/BSON/Regex.c b/src/BSON/Regex.c index 1cc229a1a..6c741d2de 100644 --- a/src/BSON/Regex.c +++ b/src/BSON/Regex.c @@ -79,12 +79,12 @@ static bool php_phongo_regex_init_from_hash(php_phongo_regex_t* intern, HashTabl return false; } -static HashTable* php_phongo_regex_get_properties_hash(phongo_compat_object_handler_type* object, bool is_temp) +static HashTable* php_phongo_regex_get_properties_hash(zend_object* object, bool is_temp) { php_phongo_regex_t* intern; HashTable* props; - intern = Z_OBJ_REGEX(PHONGO_COMPAT_GET_OBJ(object)); + intern = Z_OBJ_REGEX(object); PHONGO_GET_PROPERTY_HASH_INIT_PROPS(is_temp, intern, props, 2); @@ -252,7 +252,7 @@ static PHP_METHOD(MongoDB_BSON_Regex, __serialize) { PHONGO_PARSE_PARAMETERS_NONE(); - RETURN_ARR(php_phongo_regex_get_properties_hash(PHONGO_COMPAT_OBJ_P(getThis()), true)); + RETURN_ARR(php_phongo_regex_get_properties_hash(Z_OBJ_P(getThis()), true)); } static PHP_METHOD(MongoDB_BSON_Regex, __unserialize) @@ -301,14 +301,14 @@ static zend_object* php_phongo_regex_create_object(zend_class_entry* class_type) return &intern->std; } -static zend_object* php_phongo_regex_clone_object(phongo_compat_object_handler_type* object) +static zend_object* php_phongo_regex_clone_object(zend_object* object) { php_phongo_regex_t* intern; php_phongo_regex_t* new_intern; zend_object* new_object; - intern = Z_OBJ_REGEX(PHONGO_COMPAT_GET_OBJ(object)); - new_object = php_phongo_regex_create_object(PHONGO_COMPAT_GET_OBJ(object)->ce); + intern = Z_OBJ_REGEX(object); + new_object = php_phongo_regex_create_object(object->ce); new_intern = Z_OBJ_REGEX(new_object); zend_objects_clone_members(&new_intern->std, &intern->std); @@ -338,28 +338,24 @@ static int php_phongo_regex_compare_objects(zval* o1, zval* o2) return strcmp(intern1->flags, intern2->flags); } -static HashTable* php_phongo_regex_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) +static HashTable* php_phongo_regex_get_debug_info(zend_object* object, int* is_temp) { *is_temp = 1; return php_phongo_regex_get_properties_hash(object, true); } -static HashTable* php_phongo_regex_get_properties(phongo_compat_object_handler_type* object) +static HashTable* php_phongo_regex_get_properties(zend_object* object) { return php_phongo_regex_get_properties_hash(object, false); } void php_phongo_regex_init_ce(INIT_FUNC_ARGS) { - php_phongo_regex_ce = register_class_MongoDB_BSON_Regex(php_phongo_regex_interface_ce, php_phongo_json_serializable_ce, php_phongo_type_ce, zend_ce_serializable); + php_phongo_regex_ce = register_class_MongoDB_BSON_Regex(php_phongo_regex_interface_ce, php_phongo_json_serializable_ce, php_phongo_type_ce, zend_ce_serializable, zend_ce_stringable); php_phongo_regex_ce->create_object = php_phongo_regex_create_object; -#if PHP_VERSION_ID >= 80000 - zend_class_implements(php_phongo_regex_ce, 1, zend_ce_stringable); -#endif - memcpy(&php_phongo_handler_regex, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); - PHONGO_COMPAT_SET_COMPARE_OBJECTS_HANDLER(regex); + php_phongo_handler_regex.compare = php_phongo_regex_compare_objects; php_phongo_handler_regex.clone_obj = php_phongo_regex_clone_object; php_phongo_handler_regex.get_debug_info = php_phongo_regex_get_debug_info; php_phongo_handler_regex.get_properties = php_phongo_regex_get_properties; diff --git a/src/BSON/Regex.stub.php b/src/BSON/Regex.stub.php index e573878fe..e4224bdfb 100644 --- a/src/BSON/Regex.stub.php +++ b/src/BSON/Regex.stub.php @@ -7,7 +7,7 @@ namespace MongoDB\BSON; -final class Regex implements RegexInterface, \JsonSerializable, Type, \Serializable +final class Regex implements RegexInterface, \JsonSerializable, Type, \Serializable, \Stringable { final public function __construct(string $pattern, string $flags = '') {} @@ -21,21 +21,11 @@ final public static function __set_state(array $properties): Regex {} final public function serialize(): string {} -#if PHP_VERSION_ID >= 80000 final public function unserialize(string $data): void {} -#else - /** @param string $serialized */ - final public function unserialize($serialized): void {} -#endif final public function __unserialize(array $data): void {} final public function __serialize(): array {} -#if PHP_VERSION_ID >= 80000 final public function jsonSerialize(): mixed {} -#else - /** @return mixed */ - final public function jsonSerialize() {} -#endif } diff --git a/src/BSON/Regex_arginfo.h b/src/BSON/Regex_arginfo.h index 671f14372..9b5b09dbf 100644 --- a/src/BSON/Regex_arginfo.h +++ b/src/BSON/Regex_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 5b1d9031775fd7c2a0c9585da00887ddf5c1dbe2 */ + * Stub hash: aa53c6b26b0dea96d357c59b51b4c6e9f5a21317 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Regex___construct, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0) @@ -19,17 +19,9 @@ ZEND_END_ARG_INFO() #define arginfo_class_MongoDB_BSON_Regex_serialize arginfo_class_MongoDB_BSON_Regex_getPattern -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Regex_unserialize, 0, 1, IS_VOID, 0) ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0) ZEND_END_ARG_INFO() -#endif - -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Regex_unserialize, 0, 1, IS_VOID, 0) - ZEND_ARG_INFO(0, serialized) -ZEND_END_ARG_INFO() -#endif ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Regex___unserialize, 0, 1, IS_VOID, 0) ZEND_ARG_TYPE_INFO(0, data, IS_ARRAY, 0) @@ -38,15 +30,8 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Regex___serialize, 0, 0, IS_ARRAY, 0) ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Regex_jsonSerialize, 0, 0, IS_MIXED, 0) ZEND_END_ARG_INFO() -#endif - -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Regex_jsonSerialize, 0, 0, 0) -ZEND_END_ARG_INFO() -#endif static ZEND_METHOD(MongoDB_BSON_Regex, __construct); @@ -55,20 +40,10 @@ static ZEND_METHOD(MongoDB_BSON_Regex, getFlags); static ZEND_METHOD(MongoDB_BSON_Regex, __toString); static ZEND_METHOD(MongoDB_BSON_Regex, __set_state); static ZEND_METHOD(MongoDB_BSON_Regex, serialize); -#if PHP_VERSION_ID >= 80000 static ZEND_METHOD(MongoDB_BSON_Regex, unserialize); -#endif -#if !(PHP_VERSION_ID >= 80000) -static ZEND_METHOD(MongoDB_BSON_Regex, unserialize); -#endif static ZEND_METHOD(MongoDB_BSON_Regex, __unserialize); static ZEND_METHOD(MongoDB_BSON_Regex, __serialize); -#if PHP_VERSION_ID >= 80000 -static ZEND_METHOD(MongoDB_BSON_Regex, jsonSerialize); -#endif -#if !(PHP_VERSION_ID >= 80000) static ZEND_METHOD(MongoDB_BSON_Regex, jsonSerialize); -#endif static const zend_function_entry class_MongoDB_BSON_Regex_methods[] = { @@ -78,31 +53,21 @@ static const zend_function_entry class_MongoDB_BSON_Regex_methods[] = { ZEND_ME(MongoDB_BSON_Regex, __toString, arginfo_class_MongoDB_BSON_Regex___toString, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_BSON_Regex, __set_state, arginfo_class_MongoDB_BSON_Regex___set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_BSON_Regex, serialize, arginfo_class_MongoDB_BSON_Regex_serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#if PHP_VERSION_ID >= 80000 ZEND_ME(MongoDB_BSON_Regex, unserialize, arginfo_class_MongoDB_BSON_Regex_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if !(PHP_VERSION_ID >= 80000) - ZEND_ME(MongoDB_BSON_Regex, unserialize, arginfo_class_MongoDB_BSON_Regex_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif ZEND_ME(MongoDB_BSON_Regex, __unserialize, arginfo_class_MongoDB_BSON_Regex___unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_BSON_Regex, __serialize, arginfo_class_MongoDB_BSON_Regex___serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#if PHP_VERSION_ID >= 80000 - ZEND_ME(MongoDB_BSON_Regex, jsonSerialize, arginfo_class_MongoDB_BSON_Regex_jsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if !(PHP_VERSION_ID >= 80000) ZEND_ME(MongoDB_BSON_Regex, jsonSerialize, arginfo_class_MongoDB_BSON_Regex_jsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif ZEND_FE_END }; -static zend_class_entry *register_class_MongoDB_BSON_Regex(zend_class_entry *class_entry_MongoDB_BSON_RegexInterface, zend_class_entry *class_entry_JsonSerializable, zend_class_entry *class_entry_MongoDB_BSON_Type, zend_class_entry *class_entry_Serializable) +static zend_class_entry *register_class_MongoDB_BSON_Regex(zend_class_entry *class_entry_MongoDB_BSON_RegexInterface, zend_class_entry *class_entry_JsonSerializable, zend_class_entry *class_entry_MongoDB_BSON_Type, zend_class_entry *class_entry_Serializable, zend_class_entry *class_entry_Stringable) { zend_class_entry ce, *class_entry; INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Regex", class_MongoDB_BSON_Regex_methods); class_entry = zend_register_internal_class_ex(&ce, NULL); class_entry->ce_flags |= ZEND_ACC_FINAL; - zend_class_implements(class_entry, 4, class_entry_MongoDB_BSON_RegexInterface, class_entry_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable); + zend_class_implements(class_entry, 5, class_entry_MongoDB_BSON_RegexInterface, class_entry_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable, class_entry_Stringable); return class_entry; } diff --git a/src/BSON/Serializable.stub.php b/src/BSON/Serializable.stub.php index 44a45d311..c12bc4a49 100644 --- a/src/BSON/Serializable.stub.php +++ b/src/BSON/Serializable.stub.php @@ -9,11 +9,6 @@ interface Serializable extends Type { -#if PHP_VERSION_ID >= 80000 /** @tentative-return-type */ public function bsonSerialize(): array|\stdClass|Document|PackedArray; -#else - /** @return array|\stdClass|Document|PackedArray */ - public function bsonSerialize(); -#endif } diff --git a/src/BSON/Serializable_arginfo.h b/src/BSON/Serializable_arginfo.h index a2039eb94..25b3d5cdc 100644 --- a/src/BSON/Serializable_arginfo.h +++ b/src/BSON/Serializable_arginfo.h @@ -1,30 +1,14 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 92732bafa65af8a12b291f7bcb52b069c45724a7 */ + * Stub hash: cf790c4aaa9d12777681842564139008ec73218b */ -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_OBJ_TYPE_MASK_EX(arginfo_class_MongoDB_BSON_Serializable_bsonSerialize, 0, 0, stdClass|MongoDB\\BSON\\Document|MongoDB\\BSON\\PackedArray, MAY_BE_ARRAY) ZEND_END_ARG_INFO() -#endif - -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Serializable_bsonSerialize, 0, 0, 0) -ZEND_END_ARG_INFO() -#endif -#if PHP_VERSION_ID >= 80000 -#endif -#if !(PHP_VERSION_ID >= 80000) -#endif static const zend_function_entry class_MongoDB_BSON_Serializable_methods[] = { -#if PHP_VERSION_ID >= 80000 - ZEND_ABSTRACT_ME_WITH_FLAGS(MongoDB_BSON_Serializable, bsonSerialize, arginfo_class_MongoDB_BSON_Serializable_bsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT) -#endif -#if !(PHP_VERSION_ID >= 80000) ZEND_ABSTRACT_ME_WITH_FLAGS(MongoDB_BSON_Serializable, bsonSerialize, arginfo_class_MongoDB_BSON_Serializable_bsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT) -#endif ZEND_FE_END }; diff --git a/src/BSON/Symbol.c b/src/BSON/Symbol.c index cbb1e1770..21523585e 100644 --- a/src/BSON/Symbol.c +++ b/src/BSON/Symbol.c @@ -54,12 +54,12 @@ static bool php_phongo_symbol_init_from_hash(php_phongo_symbol_t* intern, HashTa return false; } -HashTable* php_phongo_symbol_get_properties_hash(phongo_compat_object_handler_type* object, bool is_temp) +HashTable* php_phongo_symbol_get_properties_hash(zend_object* object, bool is_temp) { php_phongo_symbol_t* intern; HashTable* props; - intern = Z_OBJ_SYMBOL(PHONGO_COMPAT_GET_OBJ(object)); + intern = Z_OBJ_SYMBOL(object); PHONGO_GET_PROPERTY_HASH_INIT_PROPS(is_temp, intern, props, 2); @@ -178,7 +178,7 @@ static PHP_METHOD(MongoDB_BSON_Symbol, __serialize) { PHONGO_PARSE_PARAMETERS_NONE(); - ZVAL_ARR(return_value, php_phongo_symbol_get_properties_hash(PHONGO_COMPAT_OBJ_P(getThis()), true)); + ZVAL_ARR(return_value, php_phongo_symbol_get_properties_hash(Z_OBJ_P(getThis()), true)); } static PHP_METHOD(MongoDB_BSON_Symbol, __unserialize) @@ -223,14 +223,14 @@ zend_object* php_phongo_symbol_create_object(zend_class_entry* class_type) return &intern->std; } -static zend_object* php_phongo_symbol_clone_object(phongo_compat_object_handler_type* object) +static zend_object* php_phongo_symbol_clone_object(zend_object* object) { php_phongo_symbol_t* intern; php_phongo_symbol_t* new_intern; zend_object* new_object; - intern = Z_OBJ_SYMBOL(PHONGO_COMPAT_GET_OBJ(object)); - new_object = php_phongo_symbol_create_object(PHONGO_COMPAT_GET_OBJ(object)->ce); + intern = Z_OBJ_SYMBOL(object); + new_object = php_phongo_symbol_create_object(object->ce); new_intern = Z_OBJ_SYMBOL(new_object); zend_objects_clone_members(&new_intern->std, &intern->std); @@ -252,28 +252,24 @@ static int php_phongo_symbol_compare_objects(zval* o1, zval* o2) return strcmp(intern1->symbol, intern2->symbol); } -static HashTable* php_phongo_symbol_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) +static HashTable* php_phongo_symbol_get_debug_info(zend_object* object, int* is_temp) { *is_temp = 1; return php_phongo_symbol_get_properties_hash(object, true); } -static HashTable* php_phongo_symbol_get_properties(phongo_compat_object_handler_type* object) +static HashTable* php_phongo_symbol_get_properties(zend_object* object) { return php_phongo_symbol_get_properties_hash(object, false); } void php_phongo_symbol_init_ce(INIT_FUNC_ARGS) { - php_phongo_symbol_ce = register_class_MongoDB_BSON_Symbol(php_phongo_json_serializable_ce, php_phongo_type_ce, zend_ce_serializable); + php_phongo_symbol_ce = register_class_MongoDB_BSON_Symbol(php_phongo_json_serializable_ce, php_phongo_type_ce, zend_ce_serializable, zend_ce_stringable); php_phongo_symbol_ce->create_object = php_phongo_symbol_create_object; -#if PHP_VERSION_ID >= 80000 - zend_class_implements(php_phongo_symbol_ce, 1, zend_ce_stringable); -#endif - memcpy(&php_phongo_handler_symbol, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); - PHONGO_COMPAT_SET_COMPARE_OBJECTS_HANDLER(symbol); + php_phongo_handler_symbol.compare = php_phongo_symbol_compare_objects; php_phongo_handler_symbol.clone_obj = php_phongo_symbol_clone_object; php_phongo_handler_symbol.get_debug_info = php_phongo_symbol_get_debug_info; php_phongo_handler_symbol.get_properties = php_phongo_symbol_get_properties; diff --git a/src/BSON/Symbol.stub.php b/src/BSON/Symbol.stub.php index cd72b3a71..cb7ed7a73 100644 --- a/src/BSON/Symbol.stub.php +++ b/src/BSON/Symbol.stub.php @@ -7,7 +7,7 @@ namespace MongoDB\BSON; -final class Symbol implements \JsonSerializable, Type, \Serializable +final class Symbol implements \JsonSerializable, Type, \Serializable, \Stringable { final private function __construct() {} @@ -17,21 +17,11 @@ final public static function __set_state(array $properties): Symbol {} final public function serialize(): string {} -#if PHP_VERSION_ID >= 80000 final public function unserialize(string $data): void {} -#else - /** @param string $serialized */ - final public function unserialize($serialized): void {} -#endif final public function __unserialize(array $data): void {} final public function __serialize(): array {} -#if PHP_VERSION_ID >= 80000 final public function jsonSerialize(): mixed {} -#else - /** @return mixed */ - final public function jsonSerialize() {} -#endif } diff --git a/src/BSON/Symbol_arginfo.h b/src/BSON/Symbol_arginfo.h index 13cf66d28..628400dc9 100644 --- a/src/BSON/Symbol_arginfo.h +++ b/src/BSON/Symbol_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 0d7ad975a26b424f5109301f7e8d070ce2574b48 */ + * Stub hash: d13589fe0654877d462494f88d99ff20d22cde24 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Symbol___construct, 0, 0, 0) ZEND_END_ARG_INFO() @@ -13,17 +13,9 @@ ZEND_END_ARG_INFO() #define arginfo_class_MongoDB_BSON_Symbol_serialize arginfo_class_MongoDB_BSON_Symbol___toString -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Symbol_unserialize, 0, 1, IS_VOID, 0) ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0) ZEND_END_ARG_INFO() -#endif - -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Symbol_unserialize, 0, 1, IS_VOID, 0) - ZEND_ARG_INFO(0, serialized) -ZEND_END_ARG_INFO() -#endif ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Symbol___unserialize, 0, 1, IS_VOID, 0) ZEND_ARG_TYPE_INFO(0, data, IS_ARRAY, 0) @@ -32,35 +24,18 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Symbol___serialize, 0, 0, IS_ARRAY, 0) ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Symbol_jsonSerialize, 0, 0, IS_MIXED, 0) ZEND_END_ARG_INFO() -#endif - -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Symbol_jsonSerialize, 0, 0, 0) -ZEND_END_ARG_INFO() -#endif static ZEND_METHOD(MongoDB_BSON_Symbol, __construct); static ZEND_METHOD(MongoDB_BSON_Symbol, __toString); static ZEND_METHOD(MongoDB_BSON_Symbol, __set_state); static ZEND_METHOD(MongoDB_BSON_Symbol, serialize); -#if PHP_VERSION_ID >= 80000 static ZEND_METHOD(MongoDB_BSON_Symbol, unserialize); -#endif -#if !(PHP_VERSION_ID >= 80000) -static ZEND_METHOD(MongoDB_BSON_Symbol, unserialize); -#endif static ZEND_METHOD(MongoDB_BSON_Symbol, __unserialize); static ZEND_METHOD(MongoDB_BSON_Symbol, __serialize); -#if PHP_VERSION_ID >= 80000 -static ZEND_METHOD(MongoDB_BSON_Symbol, jsonSerialize); -#endif -#if !(PHP_VERSION_ID >= 80000) static ZEND_METHOD(MongoDB_BSON_Symbol, jsonSerialize); -#endif static const zend_function_entry class_MongoDB_BSON_Symbol_methods[] = { @@ -68,31 +43,21 @@ static const zend_function_entry class_MongoDB_BSON_Symbol_methods[] = { ZEND_ME(MongoDB_BSON_Symbol, __toString, arginfo_class_MongoDB_BSON_Symbol___toString, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_BSON_Symbol, __set_state, arginfo_class_MongoDB_BSON_Symbol___set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_BSON_Symbol, serialize, arginfo_class_MongoDB_BSON_Symbol_serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#if PHP_VERSION_ID >= 80000 ZEND_ME(MongoDB_BSON_Symbol, unserialize, arginfo_class_MongoDB_BSON_Symbol_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if !(PHP_VERSION_ID >= 80000) - ZEND_ME(MongoDB_BSON_Symbol, unserialize, arginfo_class_MongoDB_BSON_Symbol_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif ZEND_ME(MongoDB_BSON_Symbol, __unserialize, arginfo_class_MongoDB_BSON_Symbol___unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_BSON_Symbol, __serialize, arginfo_class_MongoDB_BSON_Symbol___serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#if PHP_VERSION_ID >= 80000 - ZEND_ME(MongoDB_BSON_Symbol, jsonSerialize, arginfo_class_MongoDB_BSON_Symbol_jsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if !(PHP_VERSION_ID >= 80000) ZEND_ME(MongoDB_BSON_Symbol, jsonSerialize, arginfo_class_MongoDB_BSON_Symbol_jsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif ZEND_FE_END }; -static zend_class_entry *register_class_MongoDB_BSON_Symbol(zend_class_entry *class_entry_JsonSerializable, zend_class_entry *class_entry_MongoDB_BSON_Type, zend_class_entry *class_entry_Serializable) +static zend_class_entry *register_class_MongoDB_BSON_Symbol(zend_class_entry *class_entry_JsonSerializable, zend_class_entry *class_entry_MongoDB_BSON_Type, zend_class_entry *class_entry_Serializable, zend_class_entry *class_entry_Stringable) { zend_class_entry ce, *class_entry; INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Symbol", class_MongoDB_BSON_Symbol_methods); class_entry = zend_register_internal_class_ex(&ce, NULL); class_entry->ce_flags |= ZEND_ACC_FINAL; - zend_class_implements(class_entry, 3, class_entry_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable); + zend_class_implements(class_entry, 4, class_entry_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable, class_entry_Stringable); return class_entry; } diff --git a/src/BSON/Timestamp.c b/src/BSON/Timestamp.c index 9c01e5112..6d0df3a4c 100644 --- a/src/BSON/Timestamp.c +++ b/src/BSON/Timestamp.c @@ -87,7 +87,7 @@ static bool php_phongo_timestamp_init_from_hash(php_phongo_timestamp_t* intern, return false; } -static HashTable* php_phongo_timestamp_get_properties_hash(phongo_compat_object_handler_type* object, bool is_temp) +static HashTable* php_phongo_timestamp_get_properties_hash(zend_object* object, bool is_temp) { php_phongo_timestamp_t* intern; HashTable* props; @@ -96,7 +96,7 @@ static HashTable* php_phongo_timestamp_get_properties_hash(phongo_compat_object_ int s_increment_len; int s_timestamp_len; - intern = Z_OBJ_TIMESTAMP(PHONGO_COMPAT_GET_OBJ(object)); + intern = Z_OBJ_TIMESTAMP(object); PHONGO_GET_PROPERTY_HASH_INIT_PROPS(is_temp, intern, props, 2); @@ -301,7 +301,7 @@ static PHP_METHOD(MongoDB_BSON_Timestamp, __serialize) { PHONGO_PARSE_PARAMETERS_NONE(); - RETURN_ARR(php_phongo_timestamp_get_properties_hash(PHONGO_COMPAT_OBJ_P(getThis()), true)); + RETURN_ARR(php_phongo_timestamp_get_properties_hash(Z_OBJ_P(getThis()), true)); } static PHP_METHOD(MongoDB_BSON_Timestamp, __unserialize) @@ -342,14 +342,14 @@ static zend_object* php_phongo_timestamp_create_object(zend_class_entry* class_t return &intern->std; } -static zend_object* php_phongo_timestamp_clone_object(phongo_compat_object_handler_type* object) +static zend_object* php_phongo_timestamp_clone_object(zend_object* object) { php_phongo_timestamp_t* intern; php_phongo_timestamp_t* new_intern; zend_object* new_object; - intern = Z_OBJ_TIMESTAMP(PHONGO_COMPAT_GET_OBJ(object)); - new_object = php_phongo_timestamp_create_object(PHONGO_COMPAT_GET_OBJ(object)->ce); + intern = Z_OBJ_TIMESTAMP(object); + new_object = php_phongo_timestamp_create_object(object->ce); new_intern = Z_OBJ_TIMESTAMP(new_object); zend_objects_clone_members(&new_intern->std, &intern->std); @@ -380,28 +380,24 @@ static int php_phongo_timestamp_compare_objects(zval* o1, zval* o2) return 0; } -static HashTable* php_phongo_timestamp_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) +static HashTable* php_phongo_timestamp_get_debug_info(zend_object* object, int* is_temp) { *is_temp = 1; return php_phongo_timestamp_get_properties_hash(object, true); } -static HashTable* php_phongo_timestamp_get_properties(phongo_compat_object_handler_type* object) +static HashTable* php_phongo_timestamp_get_properties(zend_object* object) { return php_phongo_timestamp_get_properties_hash(object, false); } void php_phongo_timestamp_init_ce(INIT_FUNC_ARGS) { - php_phongo_timestamp_ce = register_class_MongoDB_BSON_Timestamp(php_phongo_timestamp_interface_ce, php_phongo_json_serializable_ce, php_phongo_type_ce, zend_ce_serializable); + php_phongo_timestamp_ce = register_class_MongoDB_BSON_Timestamp(php_phongo_timestamp_interface_ce, php_phongo_json_serializable_ce, php_phongo_type_ce, zend_ce_serializable, zend_ce_stringable); php_phongo_timestamp_ce->create_object = php_phongo_timestamp_create_object; -#if PHP_VERSION_ID >= 80000 - zend_class_implements(php_phongo_timestamp_ce, 1, zend_ce_stringable); -#endif - memcpy(&php_phongo_handler_timestamp, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); - PHONGO_COMPAT_SET_COMPARE_OBJECTS_HANDLER(timestamp); + php_phongo_handler_timestamp.compare = php_phongo_timestamp_compare_objects; php_phongo_handler_timestamp.clone_obj = php_phongo_timestamp_clone_object; php_phongo_handler_timestamp.get_debug_info = php_phongo_timestamp_get_debug_info; php_phongo_handler_timestamp.get_properties = php_phongo_timestamp_get_properties; diff --git a/src/BSON/Timestamp.stub.php b/src/BSON/Timestamp.stub.php index 36cfcb938..eaa86e993 100644 --- a/src/BSON/Timestamp.stub.php +++ b/src/BSON/Timestamp.stub.php @@ -7,17 +7,9 @@ namespace MongoDB\BSON; -final class Timestamp implements TimestampInterface, \JsonSerializable, Type, \Serializable +final class Timestamp implements TimestampInterface, \JsonSerializable, Type, \Serializable, \Stringable { -#if PHP_VERSION_ID >= 80000 final public function __construct(int|string $increment, int|string $timestamp) {} -#else - /** - * @param int|string $increment - * @param int|string $timestamp - */ - final public function __construct($increment, $timestamp) {} -#endif final public function getTimestamp(): int {} @@ -29,21 +21,11 @@ final public static function __set_state(array $properties): Timestamp {} final public function serialize(): string {} -#if PHP_VERSION_ID >= 80000 final public function unserialize(string $data): void {} -#else - /** @param string $serialized */ - final public function unserialize($serialized): void {} -#endif final public function __unserialize(array $data): void {} final public function __serialize(): array {} -#if PHP_VERSION_ID >= 80000 final public function jsonSerialize(): mixed {} -#else - /** @return mixed */ - final public function jsonSerialize() {} -#endif } diff --git a/src/BSON/Timestamp_arginfo.h b/src/BSON/Timestamp_arginfo.h index ebf10e69e..9bfe856a5 100644 --- a/src/BSON/Timestamp_arginfo.h +++ b/src/BSON/Timestamp_arginfo.h @@ -1,19 +1,10 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 619c2fd0276dd6de1b8585e4cfeb038d8e4b753f */ + * Stub hash: 32e036d627150cc5d09cf687eb4ae0e469fbc198 */ -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Timestamp___construct, 0, 0, 2) ZEND_ARG_TYPE_MASK(0, increment, MAY_BE_LONG|MAY_BE_STRING, NULL) ZEND_ARG_TYPE_MASK(0, timestamp, MAY_BE_LONG|MAY_BE_STRING, NULL) ZEND_END_ARG_INFO() -#endif - -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Timestamp___construct, 0, 0, 2) - ZEND_ARG_INFO(0, increment) - ZEND_ARG_INFO(0, timestamp) -ZEND_END_ARG_INFO() -#endif ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Timestamp_getTimestamp, 0, 0, IS_LONG, 0) ZEND_END_ARG_INFO() @@ -29,17 +20,9 @@ ZEND_END_ARG_INFO() #define arginfo_class_MongoDB_BSON_Timestamp_serialize arginfo_class_MongoDB_BSON_Timestamp___toString -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Timestamp_unserialize, 0, 1, IS_VOID, 0) ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0) ZEND_END_ARG_INFO() -#endif - -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Timestamp_unserialize, 0, 1, IS_VOID, 0) - ZEND_ARG_INFO(0, serialized) -ZEND_END_ARG_INFO() -#endif ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Timestamp___unserialize, 0, 1, IS_VOID, 0) ZEND_ARG_TYPE_INFO(0, data, IS_ARRAY, 0) @@ -48,81 +31,44 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Timestamp___serialize, 0, 0, IS_ARRAY, 0) ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Timestamp_jsonSerialize, 0, 0, IS_MIXED, 0) ZEND_END_ARG_INFO() -#endif - -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Timestamp_jsonSerialize, 0, 0, 0) -ZEND_END_ARG_INFO() -#endif -#if PHP_VERSION_ID >= 80000 -static ZEND_METHOD(MongoDB_BSON_Timestamp, __construct); -#endif -#if !(PHP_VERSION_ID >= 80000) static ZEND_METHOD(MongoDB_BSON_Timestamp, __construct); -#endif static ZEND_METHOD(MongoDB_BSON_Timestamp, getTimestamp); static ZEND_METHOD(MongoDB_BSON_Timestamp, getIncrement); static ZEND_METHOD(MongoDB_BSON_Timestamp, __toString); static ZEND_METHOD(MongoDB_BSON_Timestamp, __set_state); static ZEND_METHOD(MongoDB_BSON_Timestamp, serialize); -#if PHP_VERSION_ID >= 80000 static ZEND_METHOD(MongoDB_BSON_Timestamp, unserialize); -#endif -#if !(PHP_VERSION_ID >= 80000) -static ZEND_METHOD(MongoDB_BSON_Timestamp, unserialize); -#endif static ZEND_METHOD(MongoDB_BSON_Timestamp, __unserialize); static ZEND_METHOD(MongoDB_BSON_Timestamp, __serialize); -#if PHP_VERSION_ID >= 80000 -static ZEND_METHOD(MongoDB_BSON_Timestamp, jsonSerialize); -#endif -#if !(PHP_VERSION_ID >= 80000) static ZEND_METHOD(MongoDB_BSON_Timestamp, jsonSerialize); -#endif static const zend_function_entry class_MongoDB_BSON_Timestamp_methods[] = { -#if PHP_VERSION_ID >= 80000 ZEND_ME(MongoDB_BSON_Timestamp, __construct, arginfo_class_MongoDB_BSON_Timestamp___construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if !(PHP_VERSION_ID >= 80000) - ZEND_ME(MongoDB_BSON_Timestamp, __construct, arginfo_class_MongoDB_BSON_Timestamp___construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif ZEND_ME(MongoDB_BSON_Timestamp, getTimestamp, arginfo_class_MongoDB_BSON_Timestamp_getTimestamp, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_BSON_Timestamp, getIncrement, arginfo_class_MongoDB_BSON_Timestamp_getIncrement, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_BSON_Timestamp, __toString, arginfo_class_MongoDB_BSON_Timestamp___toString, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_BSON_Timestamp, __set_state, arginfo_class_MongoDB_BSON_Timestamp___set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_BSON_Timestamp, serialize, arginfo_class_MongoDB_BSON_Timestamp_serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#if PHP_VERSION_ID >= 80000 - ZEND_ME(MongoDB_BSON_Timestamp, unserialize, arginfo_class_MongoDB_BSON_Timestamp_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if !(PHP_VERSION_ID >= 80000) ZEND_ME(MongoDB_BSON_Timestamp, unserialize, arginfo_class_MongoDB_BSON_Timestamp_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif ZEND_ME(MongoDB_BSON_Timestamp, __unserialize, arginfo_class_MongoDB_BSON_Timestamp___unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_BSON_Timestamp, __serialize, arginfo_class_MongoDB_BSON_Timestamp___serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#if PHP_VERSION_ID >= 80000 - ZEND_ME(MongoDB_BSON_Timestamp, jsonSerialize, arginfo_class_MongoDB_BSON_Timestamp_jsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if !(PHP_VERSION_ID >= 80000) ZEND_ME(MongoDB_BSON_Timestamp, jsonSerialize, arginfo_class_MongoDB_BSON_Timestamp_jsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif ZEND_FE_END }; -static zend_class_entry *register_class_MongoDB_BSON_Timestamp(zend_class_entry *class_entry_MongoDB_BSON_TimestampInterface, zend_class_entry *class_entry_JsonSerializable, zend_class_entry *class_entry_MongoDB_BSON_Type, zend_class_entry *class_entry_Serializable) +static zend_class_entry *register_class_MongoDB_BSON_Timestamp(zend_class_entry *class_entry_MongoDB_BSON_TimestampInterface, zend_class_entry *class_entry_JsonSerializable, zend_class_entry *class_entry_MongoDB_BSON_Type, zend_class_entry *class_entry_Serializable, zend_class_entry *class_entry_Stringable) { zend_class_entry ce, *class_entry; INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Timestamp", class_MongoDB_BSON_Timestamp_methods); class_entry = zend_register_internal_class_ex(&ce, NULL); class_entry->ce_flags |= ZEND_ACC_FINAL; - zend_class_implements(class_entry, 4, class_entry_MongoDB_BSON_TimestampInterface, class_entry_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable); + zend_class_implements(class_entry, 5, class_entry_MongoDB_BSON_TimestampInterface, class_entry_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable, class_entry_Stringable); return class_entry; } diff --git a/src/BSON/UTCDateTime.c b/src/BSON/UTCDateTime.c index 8cb153f84..70184bbe8 100644 --- a/src/BSON/UTCDateTime.c +++ b/src/BSON/UTCDateTime.c @@ -104,12 +104,12 @@ static bool php_phongo_utcdatetime_init_from_date(php_phongo_utcdatetime_t* inte return true; } -static HashTable* php_phongo_utcdatetime_get_properties_hash(phongo_compat_object_handler_type* object, bool is_temp) +static HashTable* php_phongo_utcdatetime_get_properties_hash(zend_object* object, bool is_temp) { php_phongo_utcdatetime_t* intern; HashTable* props; - intern = Z_OBJ_UTCDATETIME(PHONGO_COMPAT_GET_OBJ(object)); + intern = Z_OBJ_UTCDATETIME(object); PHONGO_GET_PROPERTY_HASH_INIT_PROPS(is_temp, intern, props, 1); @@ -333,7 +333,7 @@ static PHP_METHOD(MongoDB_BSON_UTCDateTime, __serialize) { PHONGO_PARSE_PARAMETERS_NONE(); - RETURN_ARR(php_phongo_utcdatetime_get_properties_hash(PHONGO_COMPAT_OBJ_P(getThis()), true)); + RETURN_ARR(php_phongo_utcdatetime_get_properties_hash(Z_OBJ_P(getThis()), true)); } static PHP_METHOD(MongoDB_BSON_UTCDateTime, __unserialize) @@ -374,14 +374,14 @@ static zend_object* php_phongo_utcdatetime_create_object(zend_class_entry* class return &intern->std; } -static zend_object* php_phongo_utcdatetime_clone_object(phongo_compat_object_handler_type* object) +static zend_object* php_phongo_utcdatetime_clone_object(zend_object* object) { php_phongo_utcdatetime_t* intern; php_phongo_utcdatetime_t* new_intern; zend_object* new_object; - intern = Z_OBJ_UTCDATETIME(PHONGO_COMPAT_GET_OBJ(object)); - new_object = php_phongo_utcdatetime_create_object(PHONGO_COMPAT_GET_OBJ(object)->ce); + intern = Z_OBJ_UTCDATETIME(object); + new_object = php_phongo_utcdatetime_create_object(object->ce); new_intern = Z_OBJ_UTCDATETIME(new_object); zend_objects_clone_members(&new_intern->std, &intern->std); @@ -407,28 +407,24 @@ static int php_phongo_utcdatetime_compare_objects(zval* o1, zval* o2) return 0; } -static HashTable* php_phongo_utcdatetime_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) +static HashTable* php_phongo_utcdatetime_get_debug_info(zend_object* object, int* is_temp) { *is_temp = 1; return php_phongo_utcdatetime_get_properties_hash(object, true); } -static HashTable* php_phongo_utcdatetime_get_properties(phongo_compat_object_handler_type* object) +static HashTable* php_phongo_utcdatetime_get_properties(zend_object* object) { return php_phongo_utcdatetime_get_properties_hash(object, false); } void php_phongo_utcdatetime_init_ce(INIT_FUNC_ARGS) { - php_phongo_utcdatetime_ce = register_class_MongoDB_BSON_UTCDateTime(php_phongo_utcdatetime_interface_ce, php_phongo_json_serializable_ce, php_phongo_type_ce, zend_ce_serializable); + php_phongo_utcdatetime_ce = register_class_MongoDB_BSON_UTCDateTime(php_phongo_utcdatetime_interface_ce, php_phongo_json_serializable_ce, php_phongo_type_ce, zend_ce_serializable, zend_ce_stringable); php_phongo_utcdatetime_ce->create_object = php_phongo_utcdatetime_create_object; -#if PHP_VERSION_ID >= 80000 - zend_class_implements(php_phongo_utcdatetime_ce, 1, zend_ce_stringable); -#endif - memcpy(&php_phongo_handler_utcdatetime, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); - PHONGO_COMPAT_SET_COMPARE_OBJECTS_HANDLER(utcdatetime); + php_phongo_handler_utcdatetime.compare = php_phongo_utcdatetime_compare_objects; php_phongo_handler_utcdatetime.clone_obj = php_phongo_utcdatetime_clone_object; php_phongo_handler_utcdatetime.get_debug_info = php_phongo_utcdatetime_get_debug_info; php_phongo_handler_utcdatetime.get_properties = php_phongo_utcdatetime_get_properties; diff --git a/src/BSON/UTCDateTime.stub.php b/src/BSON/UTCDateTime.stub.php index ac9143a33..7920a6596 100644 --- a/src/BSON/UTCDateTime.stub.php +++ b/src/BSON/UTCDateTime.stub.php @@ -7,14 +7,9 @@ namespace MongoDB\BSON; -final class UTCDateTime implements UTCDateTimeInterface, \JsonSerializable, Type, \Serializable +final class UTCDateTime implements UTCDateTimeInterface, \JsonSerializable, Type, \Serializable, \Stringable { -#if PHP_VERSION_ID >= 80000 final public function __construct(int|string|float|\DateTimeInterface|null $milliseconds = null) {} -#else - /** @param int|string|float|\DateTimeInterface|null $milliseconds */ - final public function __construct($milliseconds = null) {} -#endif final public function toDateTime(): \DateTime {} @@ -26,21 +21,11 @@ final public static function __set_state(array $properties): UTCDateTime {} final public function serialize(): string {} -#if PHP_VERSION_ID >= 80000 final public function unserialize(string $data): void {} -#else - /** @param string $serialized */ - final public function unserialize($serialized): void {} -#endif final public function __unserialize(array $data): void {} final public function __serialize(): array {} -#if PHP_VERSION_ID >= 80000 final public function jsonSerialize(): mixed {} -#else - /** @return mixed */ - final public function jsonSerialize() {} -#endif } diff --git a/src/BSON/UTCDateTime_arginfo.h b/src/BSON/UTCDateTime_arginfo.h index df008acda..85f0425c7 100644 --- a/src/BSON/UTCDateTime_arginfo.h +++ b/src/BSON/UTCDateTime_arginfo.h @@ -1,17 +1,9 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 2b7ac84585a74a210af3cb2061541977cc309e2d */ + * Stub hash: 69e29517570ef1d63c5d5dffea2e893845d7d95e */ -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_UTCDateTime___construct, 0, 0, 0) ZEND_ARG_OBJ_TYPE_MASK(0, milliseconds, DateTimeInterface, MAY_BE_LONG|MAY_BE_STRING|MAY_BE_DOUBLE|MAY_BE_NULL, "null") ZEND_END_ARG_INFO() -#endif - -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_UTCDateTime___construct, 0, 0, 0) - ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, milliseconds, "null") -ZEND_END_ARG_INFO() -#endif ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_BSON_UTCDateTime_toDateTime, 0, 0, DateTime, 0) ZEND_END_ARG_INFO() @@ -28,17 +20,9 @@ ZEND_END_ARG_INFO() #define arginfo_class_MongoDB_BSON_UTCDateTime_serialize arginfo_class_MongoDB_BSON_UTCDateTime___toString -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_UTCDateTime_unserialize, 0, 1, IS_VOID, 0) ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0) ZEND_END_ARG_INFO() -#endif - -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_UTCDateTime_unserialize, 0, 1, IS_VOID, 0) - ZEND_ARG_INFO(0, serialized) -ZEND_END_ARG_INFO() -#endif ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_UTCDateTime___unserialize, 0, 1, IS_VOID, 0) ZEND_ARG_TYPE_INFO(0, data, IS_ARRAY, 0) @@ -47,81 +31,44 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_UTCDateTime___serialize, 0, 0, IS_ARRAY, 0) ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_UTCDateTime_jsonSerialize, 0, 0, IS_MIXED, 0) ZEND_END_ARG_INFO() -#endif - -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_UTCDateTime_jsonSerialize, 0, 0, 0) -ZEND_END_ARG_INFO() -#endif -#if PHP_VERSION_ID >= 80000 -static ZEND_METHOD(MongoDB_BSON_UTCDateTime, __construct); -#endif -#if !(PHP_VERSION_ID >= 80000) static ZEND_METHOD(MongoDB_BSON_UTCDateTime, __construct); -#endif static ZEND_METHOD(MongoDB_BSON_UTCDateTime, toDateTime); static ZEND_METHOD(MongoDB_BSON_UTCDateTime, toDateTimeImmutable); static ZEND_METHOD(MongoDB_BSON_UTCDateTime, __toString); static ZEND_METHOD(MongoDB_BSON_UTCDateTime, __set_state); static ZEND_METHOD(MongoDB_BSON_UTCDateTime, serialize); -#if PHP_VERSION_ID >= 80000 static ZEND_METHOD(MongoDB_BSON_UTCDateTime, unserialize); -#endif -#if !(PHP_VERSION_ID >= 80000) -static ZEND_METHOD(MongoDB_BSON_UTCDateTime, unserialize); -#endif static ZEND_METHOD(MongoDB_BSON_UTCDateTime, __unserialize); static ZEND_METHOD(MongoDB_BSON_UTCDateTime, __serialize); -#if PHP_VERSION_ID >= 80000 -static ZEND_METHOD(MongoDB_BSON_UTCDateTime, jsonSerialize); -#endif -#if !(PHP_VERSION_ID >= 80000) static ZEND_METHOD(MongoDB_BSON_UTCDateTime, jsonSerialize); -#endif static const zend_function_entry class_MongoDB_BSON_UTCDateTime_methods[] = { -#if PHP_VERSION_ID >= 80000 ZEND_ME(MongoDB_BSON_UTCDateTime, __construct, arginfo_class_MongoDB_BSON_UTCDateTime___construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if !(PHP_VERSION_ID >= 80000) - ZEND_ME(MongoDB_BSON_UTCDateTime, __construct, arginfo_class_MongoDB_BSON_UTCDateTime___construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif ZEND_ME(MongoDB_BSON_UTCDateTime, toDateTime, arginfo_class_MongoDB_BSON_UTCDateTime_toDateTime, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_BSON_UTCDateTime, toDateTimeImmutable, arginfo_class_MongoDB_BSON_UTCDateTime_toDateTimeImmutable, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_BSON_UTCDateTime, __toString, arginfo_class_MongoDB_BSON_UTCDateTime___toString, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_BSON_UTCDateTime, __set_state, arginfo_class_MongoDB_BSON_UTCDateTime___set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_BSON_UTCDateTime, serialize, arginfo_class_MongoDB_BSON_UTCDateTime_serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#if PHP_VERSION_ID >= 80000 - ZEND_ME(MongoDB_BSON_UTCDateTime, unserialize, arginfo_class_MongoDB_BSON_UTCDateTime_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if !(PHP_VERSION_ID >= 80000) ZEND_ME(MongoDB_BSON_UTCDateTime, unserialize, arginfo_class_MongoDB_BSON_UTCDateTime_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif ZEND_ME(MongoDB_BSON_UTCDateTime, __unserialize, arginfo_class_MongoDB_BSON_UTCDateTime___unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_BSON_UTCDateTime, __serialize, arginfo_class_MongoDB_BSON_UTCDateTime___serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#if PHP_VERSION_ID >= 80000 - ZEND_ME(MongoDB_BSON_UTCDateTime, jsonSerialize, arginfo_class_MongoDB_BSON_UTCDateTime_jsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if !(PHP_VERSION_ID >= 80000) ZEND_ME(MongoDB_BSON_UTCDateTime, jsonSerialize, arginfo_class_MongoDB_BSON_UTCDateTime_jsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif ZEND_FE_END }; -static zend_class_entry *register_class_MongoDB_BSON_UTCDateTime(zend_class_entry *class_entry_MongoDB_BSON_UTCDateTimeInterface, zend_class_entry *class_entry_JsonSerializable, zend_class_entry *class_entry_MongoDB_BSON_Type, zend_class_entry *class_entry_Serializable) +static zend_class_entry *register_class_MongoDB_BSON_UTCDateTime(zend_class_entry *class_entry_MongoDB_BSON_UTCDateTimeInterface, zend_class_entry *class_entry_JsonSerializable, zend_class_entry *class_entry_MongoDB_BSON_Type, zend_class_entry *class_entry_Serializable, zend_class_entry *class_entry_Stringable) { zend_class_entry ce, *class_entry; INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "UTCDateTime", class_MongoDB_BSON_UTCDateTime_methods); class_entry = zend_register_internal_class_ex(&ce, NULL); class_entry->ce_flags |= ZEND_ACC_FINAL; - zend_class_implements(class_entry, 4, class_entry_MongoDB_BSON_UTCDateTimeInterface, class_entry_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable); + zend_class_implements(class_entry, 5, class_entry_MongoDB_BSON_UTCDateTimeInterface, class_entry_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable, class_entry_Stringable); return class_entry; } diff --git a/src/BSON/Undefined.c b/src/BSON/Undefined.c index bf2e60cbb..e3130f032 100644 --- a/src/BSON/Undefined.c +++ b/src/BSON/Undefined.c @@ -111,13 +111,9 @@ static zend_object* php_phongo_undefined_create_object(zend_class_entry* class_t void php_phongo_undefined_init_ce(INIT_FUNC_ARGS) { - php_phongo_undefined_ce = register_class_MongoDB_BSON_Undefined(php_phongo_json_serializable_ce, php_phongo_type_ce, zend_ce_serializable); + php_phongo_undefined_ce = register_class_MongoDB_BSON_Undefined(php_phongo_json_serializable_ce, php_phongo_type_ce, zend_ce_serializable, zend_ce_stringable); php_phongo_undefined_ce->create_object = php_phongo_undefined_create_object; -#if PHP_VERSION_ID >= 80000 - zend_class_implements(php_phongo_undefined_ce, 1, zend_ce_stringable); -#endif - memcpy(&php_phongo_handler_undefined, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); /* Re-assign default handler previously removed in php_phongo.c */ php_phongo_handler_undefined.clone_obj = zend_objects_clone_obj; diff --git a/src/BSON/Undefined.stub.php b/src/BSON/Undefined.stub.php index 5a050d787..66c634c6e 100644 --- a/src/BSON/Undefined.stub.php +++ b/src/BSON/Undefined.stub.php @@ -7,7 +7,7 @@ namespace MongoDB\BSON; -final class Undefined implements \JsonSerializable, Type, \Serializable +final class Undefined implements \JsonSerializable, Type, \Serializable, \Stringable { final private function __construct() {} @@ -17,21 +17,11 @@ final public static function __set_state(array $properties): Undefined {} final public function serialize(): string {} -#if PHP_VERSION_ID >= 80000 final public function unserialize(string $data): void {} -#else - /** @param string $serialized */ - final public function unserialize($serialized): void {} -#endif final public function __unserialize(array $data): void {} final public function __serialize(): array {} -#if PHP_VERSION_ID >= 80000 final public function jsonSerialize(): mixed {} -#else - /** @return mixed */ - final public function jsonSerialize() {} -#endif } diff --git a/src/BSON/Undefined_arginfo.h b/src/BSON/Undefined_arginfo.h index 8c3aff6c8..2b8a6041e 100644 --- a/src/BSON/Undefined_arginfo.h +++ b/src/BSON/Undefined_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: f86341a6f6509aa4bdcd8d82dabb696e25b5a67d */ + * Stub hash: 19f544907b65caa4d9e82581531195d1dca026fd */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Undefined___construct, 0, 0, 0) ZEND_END_ARG_INFO() @@ -13,17 +13,9 @@ ZEND_END_ARG_INFO() #define arginfo_class_MongoDB_BSON_Undefined_serialize arginfo_class_MongoDB_BSON_Undefined___toString -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Undefined_unserialize, 0, 1, IS_VOID, 0) ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0) ZEND_END_ARG_INFO() -#endif - -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Undefined_unserialize, 0, 1, IS_VOID, 0) - ZEND_ARG_INFO(0, serialized) -ZEND_END_ARG_INFO() -#endif ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Undefined___unserialize, 0, 1, IS_VOID, 0) ZEND_ARG_TYPE_INFO(0, data, IS_ARRAY, 0) @@ -32,35 +24,18 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Undefined___serialize, 0, 0, IS_ARRAY, 0) ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Undefined_jsonSerialize, 0, 0, IS_MIXED, 0) ZEND_END_ARG_INFO() -#endif - -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Undefined_jsonSerialize, 0, 0, 0) -ZEND_END_ARG_INFO() -#endif static ZEND_METHOD(MongoDB_BSON_Undefined, __construct); static ZEND_METHOD(MongoDB_BSON_Undefined, __toString); static ZEND_METHOD(MongoDB_BSON_Undefined, __set_state); static ZEND_METHOD(MongoDB_BSON_Undefined, serialize); -#if PHP_VERSION_ID >= 80000 static ZEND_METHOD(MongoDB_BSON_Undefined, unserialize); -#endif -#if !(PHP_VERSION_ID >= 80000) -static ZEND_METHOD(MongoDB_BSON_Undefined, unserialize); -#endif static ZEND_METHOD(MongoDB_BSON_Undefined, __unserialize); static ZEND_METHOD(MongoDB_BSON_Undefined, __serialize); -#if PHP_VERSION_ID >= 80000 -static ZEND_METHOD(MongoDB_BSON_Undefined, jsonSerialize); -#endif -#if !(PHP_VERSION_ID >= 80000) static ZEND_METHOD(MongoDB_BSON_Undefined, jsonSerialize); -#endif static const zend_function_entry class_MongoDB_BSON_Undefined_methods[] = { @@ -68,31 +43,21 @@ static const zend_function_entry class_MongoDB_BSON_Undefined_methods[] = { ZEND_ME(MongoDB_BSON_Undefined, __toString, arginfo_class_MongoDB_BSON_Undefined___toString, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_BSON_Undefined, __set_state, arginfo_class_MongoDB_BSON_Undefined___set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_BSON_Undefined, serialize, arginfo_class_MongoDB_BSON_Undefined_serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#if PHP_VERSION_ID >= 80000 ZEND_ME(MongoDB_BSON_Undefined, unserialize, arginfo_class_MongoDB_BSON_Undefined_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if !(PHP_VERSION_ID >= 80000) - ZEND_ME(MongoDB_BSON_Undefined, unserialize, arginfo_class_MongoDB_BSON_Undefined_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif ZEND_ME(MongoDB_BSON_Undefined, __unserialize, arginfo_class_MongoDB_BSON_Undefined___unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_BSON_Undefined, __serialize, arginfo_class_MongoDB_BSON_Undefined___serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#if PHP_VERSION_ID >= 80000 - ZEND_ME(MongoDB_BSON_Undefined, jsonSerialize, arginfo_class_MongoDB_BSON_Undefined_jsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if !(PHP_VERSION_ID >= 80000) ZEND_ME(MongoDB_BSON_Undefined, jsonSerialize, arginfo_class_MongoDB_BSON_Undefined_jsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif ZEND_FE_END }; -static zend_class_entry *register_class_MongoDB_BSON_Undefined(zend_class_entry *class_entry_JsonSerializable, zend_class_entry *class_entry_MongoDB_BSON_Type, zend_class_entry *class_entry_Serializable) +static zend_class_entry *register_class_MongoDB_BSON_Undefined(zend_class_entry *class_entry_JsonSerializable, zend_class_entry *class_entry_MongoDB_BSON_Type, zend_class_entry *class_entry_Serializable, zend_class_entry *class_entry_Stringable) { zend_class_entry ce, *class_entry; INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Undefined", class_MongoDB_BSON_Undefined_methods); class_entry = zend_register_internal_class_ex(&ce, NULL); class_entry->ce_flags |= ZEND_ACC_FINAL; - zend_class_implements(class_entry, 3, class_entry_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable); + zend_class_implements(class_entry, 4, class_entry_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable, class_entry_Stringable); return class_entry; } diff --git a/src/BSON/Unserializable.c b/src/BSON/Unserializable.c index c31910b75..4ce30684c 100644 --- a/src/BSON/Unserializable.c +++ b/src/BSON/Unserializable.c @@ -23,12 +23,10 @@ zend_class_entry* php_phongo_unserializable_ce; static int php_phongo_implement_unserializable(zend_class_entry* interface, zend_class_entry* class_type) { -#if PHP_VERSION_ID >= 80100 if (class_type->ce_flags & ZEND_ACC_ENUM) { zend_error_noreturn(E_ERROR, "Enum class %s cannot implement interface %s", ZSTR_VAL(class_type->name), ZSTR_VAL(interface->name)); return FAILURE; } -#endif /* PHP_VERSION_ID >= 80100 */ return SUCCESS; } diff --git a/src/MongoDB/BulkWrite.c b/src/MongoDB/BulkWrite.c index 2afe572b1..ffc0ccef6 100644 --- a/src/MongoDB/BulkWrite.c +++ b/src/MongoDB/BulkWrite.c @@ -589,13 +589,13 @@ static zend_object* php_phongo_bulkwrite_create_object(zend_class_entry* class_t return &intern->std; } -static HashTable* php_phongo_bulkwrite_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) +static HashTable* php_phongo_bulkwrite_get_debug_info(zend_object* object, int* is_temp) { zval retval = ZVAL_STATIC_INIT; php_phongo_bulkwrite_t* intern = NULL; *is_temp = 1; - intern = Z_OBJ_BULKWRITE(PHONGO_COMPAT_GET_OBJ(object)); + intern = Z_OBJ_BULKWRITE(object); array_init(&retval); if (intern->database) { @@ -667,7 +667,6 @@ void php_phongo_bulkwrite_init_ce(INIT_FUNC_ARGS) { php_phongo_bulkwrite_ce = register_class_MongoDB_Driver_BulkWrite(zend_ce_countable); php_phongo_bulkwrite_ce->create_object = php_phongo_bulkwrite_create_object; - PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_bulkwrite_ce); memcpy(&php_phongo_handler_bulkwrite, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); php_phongo_handler_bulkwrite.get_debug_info = php_phongo_bulkwrite_get_debug_info; diff --git a/src/MongoDB/BulkWrite.stub.php b/src/MongoDB/BulkWrite.stub.php index 1b9d269c6..2088f20d7 100644 --- a/src/MongoDB/BulkWrite.stub.php +++ b/src/MongoDB/BulkWrite.stub.php @@ -7,36 +7,16 @@ namespace MongoDB\Driver; +/** @not-serializable */ final class BulkWrite implements \Countable { final public function __construct(?array $options = null) {} public function count(): int {} -#if PHP_VERSION_ID >= 80000 public function delete(array|object $filter, ?array $deleteOptions = null): void {} -#else - /** @param array|object $filter */ - public function delete($filter, ?array $deleteOptions = null): void {} -#endif -#if PHP_VERSION_ID >= 80000 final public function insert(array|object $document): mixed {} -#else - /** - * @param array|object $document - * @return mixed - */ - final public function insert($document) {} -#endif -#if PHP_VERSION_ID >= 80000 public function update(array|object $filter, array|object $newObj, ?array $updateOptions = null): void {} -#else - /** - * @param array|object $filter - * @param array|object $newObj - */ - public function update($filter, $newObj, ?array $updateOptions = null): void {} -#endif } diff --git a/src/MongoDB/BulkWrite_arginfo.h b/src/MongoDB/BulkWrite_arginfo.h index 075cbe082..bc706095b 100644 --- a/src/MongoDB/BulkWrite_arginfo.h +++ b/src/MongoDB/BulkWrite_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 04d2be4b4398666979b03842d250984b71de5403 */ + * Stub hash: 1e91ce9db35aa0f3b77c3042099b02ac0fb381a9 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_BulkWrite___construct, 0, 0, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_ARRAY, 1, "null") @@ -8,92 +8,35 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_BulkWrite_count, 0, 0, IS_LONG, 0) ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_BulkWrite_delete, 0, 1, IS_VOID, 0) ZEND_ARG_TYPE_MASK(0, filter, MAY_BE_ARRAY|MAY_BE_OBJECT, NULL) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, deleteOptions, IS_ARRAY, 1, "null") ZEND_END_ARG_INFO() -#endif -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_BulkWrite_delete, 0, 1, IS_VOID, 0) - ZEND_ARG_INFO(0, filter) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, deleteOptions, IS_ARRAY, 1, "null") -ZEND_END_ARG_INFO() -#endif - -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_BulkWrite_insert, 0, 1, IS_MIXED, 0) ZEND_ARG_TYPE_MASK(0, document, MAY_BE_ARRAY|MAY_BE_OBJECT, NULL) ZEND_END_ARG_INFO() -#endif -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_BulkWrite_insert, 0, 0, 1) - ZEND_ARG_INFO(0, document) -ZEND_END_ARG_INFO() -#endif - -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_BulkWrite_update, 0, 2, IS_VOID, 0) ZEND_ARG_TYPE_MASK(0, filter, MAY_BE_ARRAY|MAY_BE_OBJECT, NULL) ZEND_ARG_TYPE_MASK(0, newObj, MAY_BE_ARRAY|MAY_BE_OBJECT, NULL) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, updateOptions, IS_ARRAY, 1, "null") ZEND_END_ARG_INFO() -#endif - -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_BulkWrite_update, 0, 2, IS_VOID, 0) - ZEND_ARG_INFO(0, filter) - ZEND_ARG_INFO(0, newObj) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, updateOptions, IS_ARRAY, 1, "null") -ZEND_END_ARG_INFO() -#endif static ZEND_METHOD(MongoDB_Driver_BulkWrite, __construct); static ZEND_METHOD(MongoDB_Driver_BulkWrite, count); -#if PHP_VERSION_ID >= 80000 static ZEND_METHOD(MongoDB_Driver_BulkWrite, delete); -#endif -#if !(PHP_VERSION_ID >= 80000) -static ZEND_METHOD(MongoDB_Driver_BulkWrite, delete); -#endif -#if PHP_VERSION_ID >= 80000 -static ZEND_METHOD(MongoDB_Driver_BulkWrite, insert); -#endif -#if !(PHP_VERSION_ID >= 80000) static ZEND_METHOD(MongoDB_Driver_BulkWrite, insert); -#endif -#if PHP_VERSION_ID >= 80000 static ZEND_METHOD(MongoDB_Driver_BulkWrite, update); -#endif -#if !(PHP_VERSION_ID >= 80000) -static ZEND_METHOD(MongoDB_Driver_BulkWrite, update); -#endif static const zend_function_entry class_MongoDB_Driver_BulkWrite_methods[] = { ZEND_ME(MongoDB_Driver_BulkWrite, __construct, arginfo_class_MongoDB_Driver_BulkWrite___construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_Driver_BulkWrite, count, arginfo_class_MongoDB_Driver_BulkWrite_count, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - ZEND_ME(MongoDB_Driver_BulkWrite, delete, arginfo_class_MongoDB_Driver_BulkWrite_delete, ZEND_ACC_PUBLIC) -#endif -#if !(PHP_VERSION_ID >= 80000) ZEND_ME(MongoDB_Driver_BulkWrite, delete, arginfo_class_MongoDB_Driver_BulkWrite_delete, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 ZEND_ME(MongoDB_Driver_BulkWrite, insert, arginfo_class_MongoDB_Driver_BulkWrite_insert, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if !(PHP_VERSION_ID >= 80000) - ZEND_ME(MongoDB_Driver_BulkWrite, insert, arginfo_class_MongoDB_Driver_BulkWrite_insert, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if PHP_VERSION_ID >= 80000 - ZEND_ME(MongoDB_Driver_BulkWrite, update, arginfo_class_MongoDB_Driver_BulkWrite_update, ZEND_ACC_PUBLIC) -#endif -#if !(PHP_VERSION_ID >= 80000) ZEND_ME(MongoDB_Driver_BulkWrite, update, arginfo_class_MongoDB_Driver_BulkWrite_update, ZEND_ACC_PUBLIC) -#endif ZEND_FE_END }; @@ -103,7 +46,7 @@ static zend_class_entry *register_class_MongoDB_Driver_BulkWrite(zend_class_entr INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "BulkWrite", class_MongoDB_Driver_BulkWrite_methods); class_entry = zend_register_internal_class_ex(&ce, NULL); - class_entry->ce_flags |= ZEND_ACC_FINAL; + class_entry->ce_flags |= ZEND_ACC_FINAL|ZEND_ACC_NOT_SERIALIZABLE; zend_class_implements(class_entry, 1, class_entry_Countable); return class_entry; diff --git a/src/MongoDB/ClientEncryption.c b/src/MongoDB/ClientEncryption.c index 8dc85edaa..9cfda2ae5 100644 --- a/src/MongoDB/ClientEncryption.c +++ b/src/MongoDB/ClientEncryption.c @@ -509,13 +509,13 @@ static zend_object* php_phongo_clientencryption_create_object(zend_class_entry* return &intern->std; } -static HashTable* php_phongo_clientencryption_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) +static HashTable* php_phongo_clientencryption_get_debug_info(zend_object* object, int* is_temp) { php_phongo_clientencryption_t* intern = NULL; zval retval = ZVAL_STATIC_INIT; *is_temp = 1; - intern = Z_OBJ_CLIENTENCRYPTION(PHONGO_COMPAT_GET_OBJ(object)); + intern = Z_OBJ_CLIENTENCRYPTION(object); array_init(&retval); @@ -526,7 +526,6 @@ void php_phongo_clientencryption_init_ce(INIT_FUNC_ARGS) { php_phongo_clientencryption_ce = register_class_MongoDB_Driver_ClientEncryption(); php_phongo_clientencryption_ce->create_object = php_phongo_clientencryption_create_object; - PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_clientencryption_ce); memcpy(&php_phongo_handler_clientencryption, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); php_phongo_handler_clientencryption.get_debug_info = php_phongo_clientencryption_get_debug_info; diff --git a/src/MongoDB/ClientEncryption.stub.php b/src/MongoDB/ClientEncryption.stub.php index b39fccfbc..19f2881f9 100644 --- a/src/MongoDB/ClientEncryption.stub.php +++ b/src/MongoDB/ClientEncryption.stub.php @@ -7,6 +7,7 @@ namespace MongoDB\Driver; +/** @not-serializable */ final class ClientEncryption { /** @@ -71,28 +72,13 @@ final public function addKeyAltName(\MongoDB\BSON\Binary $keyId, string $keyAltN final public function createDataKey(string $kmsProvider, ?array $options = null): \MongoDB\BSON\Binary {} -#if PHP_VERSION_ID >= 80000 final public function decrypt(\MongoDB\BSON\Binary $value): mixed {} -#else - /** @return mixed */ - final public function decrypt(\MongoDB\BSON\Binary $value) {} -#endif final public function deleteKey(\MongoDB\BSON\Binary $keyId): object {} -#if PHP_VERSION_ID >= 80000 final public function encrypt(mixed $value, ?array $options = null): \MongoDB\BSON\Binary {} -#else - /** @param mixed $value */ - final public function encrypt($value, ?array $options = null): \MongoDB\BSON\Binary {} -#endif -#if PHP_VERSION_ID >= 80000 final public function encryptExpression(array|object $expr, ?array $options = null): object {} -#else - /** @param array|object $expr */ - final public function encryptExpression($expr, ?array $options = null): object {} -#endif final public function getKey(\MongoDB\BSON\Binary $keyId): ?object {} @@ -102,10 +88,5 @@ final public function getKeys(): \MongoDB\Driver\Cursor {} final public function removeKeyAltName(\MongoDB\BSON\Binary $keyId, string $keyAltName): ?object {} -#if PHP_VERSION_ID >= 80000 final public function rewrapManyDataKey(array|object $filter, ?array $options = null): object {} -#else - /** @param array|object $filter */ - final public function rewrapManyDataKey($filter, ?array $options = null): object {} -#endif } diff --git a/src/MongoDB/ClientEncryption_arginfo.h b/src/MongoDB/ClientEncryption_arginfo.h index 9e779d592..b262af8a9 100644 --- a/src/MongoDB/ClientEncryption_arginfo.h +++ b/src/MongoDB/ClientEncryption_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 6b4f3a99f4dd97b08ee22a15985f0ffc4fe34ace */ + * Stub hash: 29a1460703051cab24abd6b42228c90928e18049 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_ClientEncryption___construct, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, options, IS_ARRAY, 0) @@ -15,49 +15,23 @@ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_ClientEncryp ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_ARRAY, 1, "null") ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_ClientEncryption_decrypt, 0, 1, IS_MIXED, 0) ZEND_ARG_OBJ_INFO(0, value, MongoDB\\BSON\\Binary, 0) ZEND_END_ARG_INFO() -#endif - -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_ClientEncryption_decrypt, 0, 0, 1) - ZEND_ARG_OBJ_INFO(0, value, MongoDB\\BSON\\Binary, 0) -ZEND_END_ARG_INFO() -#endif ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_ClientEncryption_deleteKey, 0, 1, IS_OBJECT, 0) ZEND_ARG_OBJ_INFO(0, keyId, MongoDB\\BSON\\Binary, 0) ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_ClientEncryption_encrypt, 0, 1, MongoDB\\BSON\\Binary, 0) ZEND_ARG_TYPE_INFO(0, value, IS_MIXED, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_ARRAY, 1, "null") ZEND_END_ARG_INFO() -#endif - -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_ClientEncryption_encrypt, 0, 1, MongoDB\\BSON\\Binary, 0) - ZEND_ARG_INFO(0, value) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_ARRAY, 1, "null") -ZEND_END_ARG_INFO() -#endif -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_ClientEncryption_encryptExpression, 0, 1, IS_OBJECT, 0) ZEND_ARG_TYPE_MASK(0, expr, MAY_BE_ARRAY|MAY_BE_OBJECT, NULL) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_ARRAY, 1, "null") ZEND_END_ARG_INFO() -#endif - -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_ClientEncryption_encryptExpression, 0, 1, IS_OBJECT, 0) - ZEND_ARG_INFO(0, expr) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_ARRAY, 1, "null") -ZEND_END_ARG_INFO() -#endif ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_ClientEncryption_getKey, 0, 1, IS_OBJECT, 1) ZEND_ARG_OBJ_INFO(0, keyId, MongoDB\\BSON\\Binary, 0) @@ -72,88 +46,39 @@ ZEND_END_ARG_INFO() #define arginfo_class_MongoDB_Driver_ClientEncryption_removeKeyAltName arginfo_class_MongoDB_Driver_ClientEncryption_addKeyAltName -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_ClientEncryption_rewrapManyDataKey, 0, 1, IS_OBJECT, 0) ZEND_ARG_TYPE_MASK(0, filter, MAY_BE_ARRAY|MAY_BE_OBJECT, NULL) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_ARRAY, 1, "null") ZEND_END_ARG_INFO() -#endif - -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_ClientEncryption_rewrapManyDataKey, 0, 1, IS_OBJECT, 0) - ZEND_ARG_INFO(0, filter) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_ARRAY, 1, "null") -ZEND_END_ARG_INFO() -#endif static ZEND_METHOD(MongoDB_Driver_ClientEncryption, __construct); static ZEND_METHOD(MongoDB_Driver_ClientEncryption, addKeyAltName); static ZEND_METHOD(MongoDB_Driver_ClientEncryption, createDataKey); -#if PHP_VERSION_ID >= 80000 static ZEND_METHOD(MongoDB_Driver_ClientEncryption, decrypt); -#endif -#if !(PHP_VERSION_ID >= 80000) -static ZEND_METHOD(MongoDB_Driver_ClientEncryption, decrypt); -#endif static ZEND_METHOD(MongoDB_Driver_ClientEncryption, deleteKey); -#if PHP_VERSION_ID >= 80000 -static ZEND_METHOD(MongoDB_Driver_ClientEncryption, encrypt); -#endif -#if !(PHP_VERSION_ID >= 80000) static ZEND_METHOD(MongoDB_Driver_ClientEncryption, encrypt); -#endif -#if PHP_VERSION_ID >= 80000 -static ZEND_METHOD(MongoDB_Driver_ClientEncryption, encryptExpression); -#endif -#if !(PHP_VERSION_ID >= 80000) static ZEND_METHOD(MongoDB_Driver_ClientEncryption, encryptExpression); -#endif static ZEND_METHOD(MongoDB_Driver_ClientEncryption, getKey); static ZEND_METHOD(MongoDB_Driver_ClientEncryption, getKeyByAltName); static ZEND_METHOD(MongoDB_Driver_ClientEncryption, getKeys); static ZEND_METHOD(MongoDB_Driver_ClientEncryption, removeKeyAltName); -#if PHP_VERSION_ID >= 80000 static ZEND_METHOD(MongoDB_Driver_ClientEncryption, rewrapManyDataKey); -#endif -#if !(PHP_VERSION_ID >= 80000) -static ZEND_METHOD(MongoDB_Driver_ClientEncryption, rewrapManyDataKey); -#endif static const zend_function_entry class_MongoDB_Driver_ClientEncryption_methods[] = { ZEND_ME(MongoDB_Driver_ClientEncryption, __construct, arginfo_class_MongoDB_Driver_ClientEncryption___construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_Driver_ClientEncryption, addKeyAltName, arginfo_class_MongoDB_Driver_ClientEncryption_addKeyAltName, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_Driver_ClientEncryption, createDataKey, arginfo_class_MongoDB_Driver_ClientEncryption_createDataKey, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#if PHP_VERSION_ID >= 80000 - ZEND_ME(MongoDB_Driver_ClientEncryption, decrypt, arginfo_class_MongoDB_Driver_ClientEncryption_decrypt, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if !(PHP_VERSION_ID >= 80000) ZEND_ME(MongoDB_Driver_ClientEncryption, decrypt, arginfo_class_MongoDB_Driver_ClientEncryption_decrypt, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif ZEND_ME(MongoDB_Driver_ClientEncryption, deleteKey, arginfo_class_MongoDB_Driver_ClientEncryption_deleteKey, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#if PHP_VERSION_ID >= 80000 - ZEND_ME(MongoDB_Driver_ClientEncryption, encrypt, arginfo_class_MongoDB_Driver_ClientEncryption_encrypt, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if !(PHP_VERSION_ID >= 80000) ZEND_ME(MongoDB_Driver_ClientEncryption, encrypt, arginfo_class_MongoDB_Driver_ClientEncryption_encrypt, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if PHP_VERSION_ID >= 80000 ZEND_ME(MongoDB_Driver_ClientEncryption, encryptExpression, arginfo_class_MongoDB_Driver_ClientEncryption_encryptExpression, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if !(PHP_VERSION_ID >= 80000) - ZEND_ME(MongoDB_Driver_ClientEncryption, encryptExpression, arginfo_class_MongoDB_Driver_ClientEncryption_encryptExpression, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif ZEND_ME(MongoDB_Driver_ClientEncryption, getKey, arginfo_class_MongoDB_Driver_ClientEncryption_getKey, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_Driver_ClientEncryption, getKeyByAltName, arginfo_class_MongoDB_Driver_ClientEncryption_getKeyByAltName, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_Driver_ClientEncryption, getKeys, arginfo_class_MongoDB_Driver_ClientEncryption_getKeys, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_Driver_ClientEncryption, removeKeyAltName, arginfo_class_MongoDB_Driver_ClientEncryption_removeKeyAltName, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#if PHP_VERSION_ID >= 80000 - ZEND_ME(MongoDB_Driver_ClientEncryption, rewrapManyDataKey, arginfo_class_MongoDB_Driver_ClientEncryption_rewrapManyDataKey, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if !(PHP_VERSION_ID >= 80000) ZEND_ME(MongoDB_Driver_ClientEncryption, rewrapManyDataKey, arginfo_class_MongoDB_Driver_ClientEncryption_rewrapManyDataKey, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif ZEND_FE_END }; @@ -163,7 +88,7 @@ static zend_class_entry *register_class_MongoDB_Driver_ClientEncryption(void) INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "ClientEncryption", class_MongoDB_Driver_ClientEncryption_methods); class_entry = zend_register_internal_class_ex(&ce, NULL); - class_entry->ce_flags |= ZEND_ACC_FINAL; + class_entry->ce_flags |= ZEND_ACC_FINAL|ZEND_ACC_NOT_SERIALIZABLE; zval const_AEAD_AES_256_CBC_HMAC_SHA_512_DETERMINISTIC_value; zend_string *const_AEAD_AES_256_CBC_HMAC_SHA_512_DETERMINISTIC_value_str = zend_string_init(MONGOC_AEAD_AES_256_CBC_HMAC_SHA_512_DETERMINISTIC, strlen(MONGOC_AEAD_AES_256_CBC_HMAC_SHA_512_DETERMINISTIC), 1); diff --git a/src/MongoDB/Command.c b/src/MongoDB/Command.c index 0b57e29a4..93f35e56d 100644 --- a/src/MongoDB/Command.c +++ b/src/MongoDB/Command.c @@ -141,13 +141,13 @@ static zend_object* php_phongo_command_create_object(zend_class_entry* class_typ return &intern->std; } -static HashTable* php_phongo_command_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) +static HashTable* php_phongo_command_get_debug_info(zend_object* object, int* is_temp) { php_phongo_command_t* intern; zval retval = ZVAL_STATIC_INIT; *is_temp = 1; - intern = Z_OBJ_COMMAND(PHONGO_COMPAT_GET_OBJ(object)); + intern = Z_OBJ_COMMAND(object); array_init_size(&retval, 1); @@ -172,7 +172,6 @@ void php_phongo_command_init_ce(INIT_FUNC_ARGS) { php_phongo_command_ce = register_class_MongoDB_Driver_Command(); php_phongo_command_ce->create_object = php_phongo_command_create_object; - PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_command_ce); memcpy(&php_phongo_handler_command, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); php_phongo_handler_command.get_debug_info = php_phongo_command_get_debug_info; diff --git a/src/MongoDB/Command.stub.php b/src/MongoDB/Command.stub.php index 73f206207..f74b652c6 100644 --- a/src/MongoDB/Command.stub.php +++ b/src/MongoDB/Command.stub.php @@ -7,12 +7,8 @@ namespace MongoDB\Driver; +/** @not-serializable */ final class Command { -#if PHP_VERSION_ID >= 80000 final public function __construct(array|object $document, ?array $commandOptions = null) {} -#else - /** @param array|object $document */ - final public function __construct($document, ?array $commandOptions = null) {} -#endif } diff --git a/src/MongoDB/Command_arginfo.h b/src/MongoDB/Command_arginfo.h index b24aa78c6..046483e76 100644 --- a/src/MongoDB/Command_arginfo.h +++ b/src/MongoDB/Command_arginfo.h @@ -1,36 +1,17 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 3f152d923c08b31fc0af5921471b25606fc64192 */ + * Stub hash: e613d505cab7a354e0e6b1e0395933169891021f */ -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_Command___construct, 0, 0, 1) ZEND_ARG_TYPE_MASK(0, document, MAY_BE_ARRAY|MAY_BE_OBJECT, NULL) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, commandOptions, IS_ARRAY, 1, "null") ZEND_END_ARG_INFO() -#endif -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_Command___construct, 0, 0, 1) - ZEND_ARG_INFO(0, document) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, commandOptions, IS_ARRAY, 1, "null") -ZEND_END_ARG_INFO() -#endif - -#if PHP_VERSION_ID >= 80000 -static ZEND_METHOD(MongoDB_Driver_Command, __construct); -#endif -#if !(PHP_VERSION_ID >= 80000) static ZEND_METHOD(MongoDB_Driver_Command, __construct); -#endif static const zend_function_entry class_MongoDB_Driver_Command_methods[] = { -#if PHP_VERSION_ID >= 80000 - ZEND_ME(MongoDB_Driver_Command, __construct, arginfo_class_MongoDB_Driver_Command___construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if !(PHP_VERSION_ID >= 80000) ZEND_ME(MongoDB_Driver_Command, __construct, arginfo_class_MongoDB_Driver_Command___construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif ZEND_FE_END }; @@ -40,7 +21,7 @@ static zend_class_entry *register_class_MongoDB_Driver_Command(void) INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "Command", class_MongoDB_Driver_Command_methods); class_entry = zend_register_internal_class_ex(&ce, NULL); - class_entry->ce_flags |= ZEND_ACC_FINAL; + class_entry->ce_flags |= ZEND_ACC_FINAL|ZEND_ACC_NOT_SERIALIZABLE; return class_entry; } diff --git a/src/MongoDB/Cursor.c b/src/MongoDB/Cursor.c index a48e27ce7..92b821d04 100644 --- a/src/MongoDB/Cursor.c +++ b/src/MongoDB/Cursor.c @@ -365,13 +365,13 @@ static zend_object* php_phongo_cursor_create_object(zend_class_entry* class_type return &intern->std; } -static HashTable* php_phongo_cursor_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) +static HashTable* php_phongo_cursor_get_debug_info(zend_object* object, int* is_temp) { php_phongo_cursor_t* intern; zval retval = ZVAL_STATIC_INIT; *is_temp = 1; - intern = Z_OBJ_CURSOR(PHONGO_COMPAT_GET_OBJ(object)); + intern = Z_OBJ_CURSOR(object); array_init_size(&retval, 10); @@ -440,7 +440,6 @@ void php_phongo_cursor_init_ce(INIT_FUNC_ARGS) { php_phongo_cursor_ce = register_class_MongoDB_Driver_Cursor(zend_ce_iterator, php_phongo_cursor_interface_ce); php_phongo_cursor_ce->create_object = php_phongo_cursor_create_object; - PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_cursor_ce); memcpy(&php_phongo_handler_cursor, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); php_phongo_handler_cursor.get_debug_info = php_phongo_cursor_get_debug_info; diff --git a/src/MongoDB/Cursor.stub.php b/src/MongoDB/Cursor.stub.php index 252ab65b8..04865eb1a 100644 --- a/src/MongoDB/Cursor.stub.php +++ b/src/MongoDB/Cursor.stub.php @@ -7,24 +7,15 @@ namespace MongoDB\Driver; +/** @not-serializable */ final class Cursor implements \Iterator, CursorInterface { final private function __construct() {} -#if PHP_VERSION_ID >= 80000 public function current(): array|object|null {} -#else - /** @return array|object|null */ - public function current() {} -#endif -#if PHP_VERSION_ID >= 80000 /** @tentative-return-type */ final public function getId(bool $asInt64 = false): CursorId|\MongoDB\BSON\Int64 {} -#else - /** @return CursorId|\MongoDB\BSON\Int64 */ - final public function getId(bool $asInt64 = false) {} -#endif final public function getServer(): Server {} diff --git a/src/MongoDB/CursorId.c b/src/MongoDB/CursorId.c index a2c263b3c..3a0576ac7 100644 --- a/src/MongoDB/CursorId.c +++ b/src/MongoDB/CursorId.c @@ -56,12 +56,12 @@ static bool php_phongo_cursorid_init_from_hash(php_phongo_cursorid_t* intern, Ha return false; } -static HashTable* php_phongo_cursorid_get_properties_hash(phongo_compat_object_handler_type* object, bool is_temp, bool is_serialize) +static HashTable* php_phongo_cursorid_get_properties_hash(zend_object* object, bool is_temp, bool is_serialize) { php_phongo_cursorid_t* intern; HashTable* props; - intern = Z_OBJ_CURSORID(PHONGO_COMPAT_GET_OBJ(object)); + intern = Z_OBJ_CURSORID(object); PHONGO_GET_PROPERTY_HASH_INIT_PROPS(is_temp, intern, props, 1); @@ -182,7 +182,7 @@ PHP_METHOD(MongoDB_Driver_CursorId, __serialize) { PHONGO_PARSE_PARAMETERS_NONE(); - RETURN_ARR(php_phongo_cursorid_get_properties_hash(PHONGO_COMPAT_OBJ_P(getThis()), true, true)); + RETURN_ARR(php_phongo_cursorid_get_properties_hash(Z_OBJ_P(getThis()), true, true)); } PHP_METHOD(MongoDB_Driver_CursorId, __unserialize) @@ -225,26 +225,22 @@ static zend_object* php_phongo_cursorid_create_object(zend_class_entry* class_ty return &intern->std; } -static HashTable* php_phongo_cursorid_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) +static HashTable* php_phongo_cursorid_get_debug_info(zend_object* object, int* is_temp) { *is_temp = 1; return php_phongo_cursorid_get_properties_hash(object, true, false); } -static HashTable* php_phongo_cursorid_get_properties(phongo_compat_object_handler_type* object) +static HashTable* php_phongo_cursorid_get_properties(zend_object* object) { return php_phongo_cursorid_get_properties_hash(object, false, false); } void php_phongo_cursorid_init_ce(INIT_FUNC_ARGS) { - php_phongo_cursorid_ce = register_class_MongoDB_Driver_CursorId(zend_ce_serializable); + php_phongo_cursorid_ce = register_class_MongoDB_Driver_CursorId(zend_ce_serializable, zend_ce_stringable); php_phongo_cursorid_ce->create_object = php_phongo_cursorid_create_object; -#if PHP_VERSION_ID >= 80000 - zend_class_implements(php_phongo_cursorid_ce, 1, zend_ce_stringable); -#endif - memcpy(&php_phongo_handler_cursorid, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); php_phongo_handler_cursorid.get_debug_info = php_phongo_cursorid_get_debug_info; php_phongo_handler_cursorid.get_properties = php_phongo_cursorid_get_properties; diff --git a/src/MongoDB/CursorId.stub.php b/src/MongoDB/CursorId.stub.php index d283f6958..55412d36a 100644 --- a/src/MongoDB/CursorId.stub.php +++ b/src/MongoDB/CursorId.stub.php @@ -7,7 +7,7 @@ namespace MongoDB\Driver; -final class CursorId implements \Serializable +final class CursorId implements \Serializable, \Stringable { final private function __construct() {} @@ -17,12 +17,7 @@ final public function __toString(): string {} final public function serialize(): string {} -#if PHP_VERSION_ID >= 80000 final public function unserialize(string $data): void {} -#else - /** @param string $serialized */ - final public function unserialize($serialized): void {} -#endif final public function __unserialize(array $data): void {} diff --git a/src/MongoDB/CursorId_arginfo.h b/src/MongoDB/CursorId_arginfo.h index f6d0b8e9a..53ecde006 100644 --- a/src/MongoDB/CursorId_arginfo.h +++ b/src/MongoDB/CursorId_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 7f5bb1818756794e7ac1d2fe75f1a0f3d8d710a1 */ + * Stub hash: f7c25df9cd8a81f89ac604821bae4a807d68ad78 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_CursorId___construct, 0, 0, 0) ZEND_END_ARG_INFO() @@ -13,17 +13,9 @@ ZEND_END_ARG_INFO() #define arginfo_class_MongoDB_Driver_CursorId_serialize arginfo_class_MongoDB_Driver_CursorId___toString -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_CursorId_unserialize, 0, 1, IS_VOID, 0) ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0) ZEND_END_ARG_INFO() -#endif - -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_CursorId_unserialize, 0, 1, IS_VOID, 0) - ZEND_ARG_INFO(0, serialized) -ZEND_END_ARG_INFO() -#endif ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_CursorId___unserialize, 0, 1, IS_VOID, 0) ZEND_ARG_TYPE_INFO(0, data, IS_ARRAY, 0) @@ -37,12 +29,7 @@ static ZEND_METHOD(MongoDB_Driver_CursorId, __construct); static ZEND_METHOD(MongoDB_Driver_CursorId, __set_state); static ZEND_METHOD(MongoDB_Driver_CursorId, __toString); static ZEND_METHOD(MongoDB_Driver_CursorId, serialize); -#if PHP_VERSION_ID >= 80000 static ZEND_METHOD(MongoDB_Driver_CursorId, unserialize); -#endif -#if !(PHP_VERSION_ID >= 80000) -static ZEND_METHOD(MongoDB_Driver_CursorId, unserialize); -#endif static ZEND_METHOD(MongoDB_Driver_CursorId, __unserialize); static ZEND_METHOD(MongoDB_Driver_CursorId, __serialize); @@ -52,25 +39,20 @@ static const zend_function_entry class_MongoDB_Driver_CursorId_methods[] = { ZEND_ME(MongoDB_Driver_CursorId, __set_state, arginfo_class_MongoDB_Driver_CursorId___set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_Driver_CursorId, __toString, arginfo_class_MongoDB_Driver_CursorId___toString, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_Driver_CursorId, serialize, arginfo_class_MongoDB_Driver_CursorId_serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#if PHP_VERSION_ID >= 80000 - ZEND_ME(MongoDB_Driver_CursorId, unserialize, arginfo_class_MongoDB_Driver_CursorId_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if !(PHP_VERSION_ID >= 80000) ZEND_ME(MongoDB_Driver_CursorId, unserialize, arginfo_class_MongoDB_Driver_CursorId_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif ZEND_ME(MongoDB_Driver_CursorId, __unserialize, arginfo_class_MongoDB_Driver_CursorId___unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_Driver_CursorId, __serialize, arginfo_class_MongoDB_Driver_CursorId___serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_FE_END }; -static zend_class_entry *register_class_MongoDB_Driver_CursorId(zend_class_entry *class_entry_Serializable) +static zend_class_entry *register_class_MongoDB_Driver_CursorId(zend_class_entry *class_entry_Serializable, zend_class_entry *class_entry_Stringable) { zend_class_entry ce, *class_entry; INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "CursorId", class_MongoDB_Driver_CursorId_methods); class_entry = zend_register_internal_class_ex(&ce, NULL); class_entry->ce_flags |= ZEND_ACC_FINAL; - zend_class_implements(class_entry, 1, class_entry_Serializable); + zend_class_implements(class_entry, 2, class_entry_Serializable, class_entry_Stringable); return class_entry; } diff --git a/src/MongoDB/CursorInterface.stub.php b/src/MongoDB/CursorInterface.stub.php index 1501659f3..f517a733a 100644 --- a/src/MongoDB/CursorInterface.stub.php +++ b/src/MongoDB/CursorInterface.stub.php @@ -9,13 +9,8 @@ interface CursorInterface extends \Traversable { -#if PHP_VERSION_ID >= 80000 /** @tentative-return-type */ public function getId(): CursorId|\MongoDB\BSON\Int64; -#else - /** @return CursorId|\MongoDB\BSON\Int64 */ - public function getId(); -#endif /** @tentative-return-type */ public function getServer(): Server; diff --git a/src/MongoDB/CursorInterface_arginfo.h b/src/MongoDB/CursorInterface_arginfo.h index 2bf1cb51c..37e67d327 100644 --- a/src/MongoDB/CursorInterface_arginfo.h +++ b/src/MongoDB/CursorInterface_arginfo.h @@ -1,15 +1,8 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 191d790b04cda72e9949774fad866f7750de5dfa */ + * Stub hash: 95f356a63692e1bb72d50c641e93a53113c43531 */ -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_OBJ_TYPE_MASK_EX(arginfo_class_MongoDB_Driver_CursorInterface_getId, 0, 0, MongoDB\\Driver\\CursorId|MongoDB\\BSON\\Int64, 0) ZEND_END_ARG_INFO() -#endif - -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_CursorInterface_getId, 0, 0, 0) -ZEND_END_ARG_INFO() -#endif ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_CursorInterface_getServer, 0, 0, MongoDB\\Driver\\Server, 0) ZEND_END_ARG_INFO() @@ -25,19 +18,10 @@ ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_C ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 -#endif -#if !(PHP_VERSION_ID >= 80000) -#endif static const zend_function_entry class_MongoDB_Driver_CursorInterface_methods[] = { -#if PHP_VERSION_ID >= 80000 - ZEND_ABSTRACT_ME_WITH_FLAGS(MongoDB_Driver_CursorInterface, getId, arginfo_class_MongoDB_Driver_CursorInterface_getId, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT) -#endif -#if !(PHP_VERSION_ID >= 80000) ZEND_ABSTRACT_ME_WITH_FLAGS(MongoDB_Driver_CursorInterface, getId, arginfo_class_MongoDB_Driver_CursorInterface_getId, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT) -#endif ZEND_ABSTRACT_ME_WITH_FLAGS(MongoDB_Driver_CursorInterface, getServer, arginfo_class_MongoDB_Driver_CursorInterface_getServer, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT) ZEND_ABSTRACT_ME_WITH_FLAGS(MongoDB_Driver_CursorInterface, isDead, arginfo_class_MongoDB_Driver_CursorInterface_isDead, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT) ZEND_ABSTRACT_ME_WITH_FLAGS(MongoDB_Driver_CursorInterface, setTypeMap, arginfo_class_MongoDB_Driver_CursorInterface_setTypeMap, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT) diff --git a/src/MongoDB/Cursor_arginfo.h b/src/MongoDB/Cursor_arginfo.h index 1874a4592..43a91e0b3 100644 --- a/src/MongoDB/Cursor_arginfo.h +++ b/src/MongoDB/Cursor_arginfo.h @@ -1,30 +1,15 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: e5e70f4036534c5aff1d55106e776e0230de53a6 */ + * Stub hash: c2927c5d481f305b1579a8968eeecc39ba921ddd */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_Cursor___construct, 0, 0, 0) ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_class_MongoDB_Driver_Cursor_current, 0, 0, MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_NULL) ZEND_END_ARG_INFO() -#endif -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_Cursor_current, 0, 0, 0) -ZEND_END_ARG_INFO() -#endif - -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_OBJ_TYPE_MASK_EX(arginfo_class_MongoDB_Driver_Cursor_getId, 0, 0, MongoDB\\Driver\\CursorId|MongoDB\\BSON\\Int64, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, asInt64, _IS_BOOL, 0, "false") ZEND_END_ARG_INFO() -#endif - -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_Cursor_getId, 0, 0, 0) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, asInt64, _IS_BOOL, 0, "false") -ZEND_END_ARG_INFO() -#endif ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Cursor_getServer, 0, 0, MongoDB\\Driver\\Server, 0) ZEND_END_ARG_INFO() @@ -51,18 +36,8 @@ ZEND_END_ARG_INFO() static ZEND_METHOD(MongoDB_Driver_Cursor, __construct); -#if PHP_VERSION_ID >= 80000 static ZEND_METHOD(MongoDB_Driver_Cursor, current); -#endif -#if !(PHP_VERSION_ID >= 80000) -static ZEND_METHOD(MongoDB_Driver_Cursor, current); -#endif -#if PHP_VERSION_ID >= 80000 -static ZEND_METHOD(MongoDB_Driver_Cursor, getId); -#endif -#if !(PHP_VERSION_ID >= 80000) static ZEND_METHOD(MongoDB_Driver_Cursor, getId); -#endif static ZEND_METHOD(MongoDB_Driver_Cursor, getServer); static ZEND_METHOD(MongoDB_Driver_Cursor, isDead); static ZEND_METHOD(MongoDB_Driver_Cursor, key); @@ -75,18 +50,8 @@ static ZEND_METHOD(MongoDB_Driver_Cursor, valid); static const zend_function_entry class_MongoDB_Driver_Cursor_methods[] = { ZEND_ME(MongoDB_Driver_Cursor, __construct, arginfo_class_MongoDB_Driver_Cursor___construct, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL) -#if PHP_VERSION_ID >= 80000 ZEND_ME(MongoDB_Driver_Cursor, current, arginfo_class_MongoDB_Driver_Cursor_current, ZEND_ACC_PUBLIC) -#endif -#if !(PHP_VERSION_ID >= 80000) - ZEND_ME(MongoDB_Driver_Cursor, current, arginfo_class_MongoDB_Driver_Cursor_current, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - ZEND_ME(MongoDB_Driver_Cursor, getId, arginfo_class_MongoDB_Driver_Cursor_getId, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if !(PHP_VERSION_ID >= 80000) ZEND_ME(MongoDB_Driver_Cursor, getId, arginfo_class_MongoDB_Driver_Cursor_getId, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif ZEND_ME(MongoDB_Driver_Cursor, getServer, arginfo_class_MongoDB_Driver_Cursor_getServer, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_Driver_Cursor, isDead, arginfo_class_MongoDB_Driver_Cursor_isDead, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_Driver_Cursor, key, arginfo_class_MongoDB_Driver_Cursor_key, ZEND_ACC_PUBLIC) @@ -104,7 +69,7 @@ static zend_class_entry *register_class_MongoDB_Driver_Cursor(zend_class_entry * INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "Cursor", class_MongoDB_Driver_Cursor_methods); class_entry = zend_register_internal_class_ex(&ce, NULL); - class_entry->ce_flags |= ZEND_ACC_FINAL; + class_entry->ce_flags |= ZEND_ACC_FINAL|ZEND_ACC_NOT_SERIALIZABLE; zend_class_implements(class_entry, 2, class_entry_Iterator, class_entry_MongoDB_Driver_CursorInterface); return class_entry; diff --git a/src/MongoDB/Exception/CommandException.c b/src/MongoDB/Exception/CommandException.c index 03f5d2955..b5d5addbc 100644 --- a/src/MongoDB/Exception/CommandException.c +++ b/src/MongoDB/Exception/CommandException.c @@ -30,7 +30,7 @@ static PHP_METHOD(MongoDB_Driver_Exception_CommandException, getResultDocument) PHONGO_PARSE_PARAMETERS_NONE(); - resultdocument = zend_read_property(php_phongo_commandexception_ce, PHONGO_COMPAT_OBJ_P(getThis()), ZEND_STRL("resultDocument"), 0, &rv); + resultdocument = zend_read_property(php_phongo_commandexception_ce, Z_OBJ_P(getThis()), ZEND_STRL("resultDocument"), 0, &rv); RETURN_ZVAL(resultdocument, 1, 0); } diff --git a/src/MongoDB/Exception/RuntimeException.c b/src/MongoDB/Exception/RuntimeException.c index 163c9e810..eb3a6c8a9 100644 --- a/src/MongoDB/Exception/RuntimeException.c +++ b/src/MongoDB/Exception/RuntimeException.c @@ -62,7 +62,7 @@ static PHP_METHOD(MongoDB_Driver_Exception_RuntimeException, hasErrorLabel) Z_PARAM_STRING(label, label_len) PHONGO_PARSE_PARAMETERS_END(); - error_labels = zend_read_property(php_phongo_runtimeexception_ce, PHONGO_COMPAT_OBJ_P(getThis()), ZEND_STRL("errorLabels"), 0, &rv); + error_labels = zend_read_property(php_phongo_runtimeexception_ce, Z_OBJ_P(getThis()), ZEND_STRL("errorLabels"), 0, &rv); RETURN_BOOL(php_phongo_has_string_array_element(error_labels, label)); } diff --git a/src/MongoDB/Exception/WriteException.c b/src/MongoDB/Exception/WriteException.c index 1fa59a8b1..c866a04cf 100644 --- a/src/MongoDB/Exception/WriteException.c +++ b/src/MongoDB/Exception/WriteException.c @@ -30,7 +30,7 @@ static PHP_METHOD(MongoDB_Driver_Exception_WriteException, getWriteResult) PHONGO_PARSE_PARAMETERS_NONE(); - writeresult = zend_read_property(php_phongo_writeexception_ce, PHONGO_COMPAT_OBJ_P(getThis()), ZEND_STRL("writeResult"), 0, &rv); + writeresult = zend_read_property(php_phongo_writeexception_ce, Z_OBJ_P(getThis()), ZEND_STRL("writeResult"), 0, &rv); RETURN_ZVAL(writeresult, 1, 0); } diff --git a/src/MongoDB/Manager.c b/src/MongoDB/Manager.c index 27540afb0..e14fffd57 100644 --- a/src/MongoDB/Manager.c +++ b/src/MongoDB/Manager.c @@ -857,7 +857,7 @@ static zend_object* php_phongo_manager_create_object(zend_class_entry* class_typ return &intern->std; } -static HashTable* php_phongo_manager_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) +static HashTable* php_phongo_manager_get_debug_info(zend_object* object, int* is_temp) { php_phongo_manager_t* intern; mongoc_server_description_t** sds; @@ -866,7 +866,7 @@ static HashTable* php_phongo_manager_get_debug_info(phongo_compat_object_handler zval cluster; *is_temp = 1; - intern = Z_OBJ_MANAGER(PHONGO_COMPAT_GET_OBJ(object)); + intern = Z_OBJ_MANAGER(object); array_init_size(&retval, 2); @@ -901,7 +901,6 @@ void php_phongo_manager_init_ce(INIT_FUNC_ARGS) { php_phongo_manager_ce = register_class_MongoDB_Driver_Manager(); php_phongo_manager_ce->create_object = php_phongo_manager_create_object; - PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_manager_ce); memcpy(&php_phongo_handler_manager, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); php_phongo_handler_manager.get_debug_info = php_phongo_manager_get_debug_info; diff --git a/src/MongoDB/Manager.stub.php b/src/MongoDB/Manager.stub.php index 7759e1898..7ebcd656a 100644 --- a/src/MongoDB/Manager.stub.php +++ b/src/MongoDB/Manager.stub.php @@ -7,6 +7,7 @@ namespace MongoDB\Driver; +/** @not-serializable */ final class Manager { final public function __construct(?string $uri = null, ?array $uriOptions = null, ?array $driverOptions = null) {} @@ -15,26 +16,11 @@ final public function addSubscriber(Monitoring\Subscriber $subscriber): void {} final public function createClientEncryption(array $options): ClientEncryption {} -#if PHP_VERSION_ID >= 80000 final public function executeBulkWrite(string $namespace, BulkWrite $bulk, array|WriteConcern|null $options = null): WriteResult {} -#else - /** @param array|WriteConcern|null $options */ - final public function executeBulkWrite(string $namespace, BulkWrite $bulk, $options = null): WriteResult {} -#endif -#if PHP_VERSION_ID >= 80000 final public function executeCommand(string $db, Command $command, array|ReadPreference|null $options = null): Cursor {} -#else - /** @param array|ReadPreference|null $options */ - final public function executeCommand(string $db, Command $command, $options = null): Cursor {} -#endif -#if PHP_VERSION_ID >= 80000 final public function executeQuery(string $namespace, Query $query, array|ReadPreference|null $options = null): Cursor {} -#else - /** @param array|ReadPreference|null $options */ - final public function executeQuery(string $namespace, Query $query, $options = null): Cursor {} -#endif final public function executeReadCommand(string $db, Command $command, ?array $options = null): Cursor {} @@ -42,12 +28,7 @@ final public function executeReadWriteCommand(string $db, Command $command, ?arr final public function executeWriteCommand(string $db, Command $command, ?array $options = null): Cursor {} -#if PHP_VERSION_ID >= 80000 final public function getEncryptedFieldsMap(): array|object|null {} -#else - /** @return array|object|null */ - final public function getEncryptedFieldsMap() {} -#endif final public function getReadConcern(): ReadConcern {} diff --git a/src/MongoDB/Manager_arginfo.h b/src/MongoDB/Manager_arginfo.h index 1204b8ccd..714ac016e 100644 --- a/src/MongoDB/Manager_arginfo.h +++ b/src/MongoDB/Manager_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 6a37566522da6a896a4525a5de2fe913d56a7a09 */ + * Stub hash: ce2904be644a230dc05dc1427f74c3717035eb06 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_Manager___construct, 0, 0, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, uri, IS_STRING, 1, "null") @@ -15,53 +15,23 @@ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Manager_crea ZEND_ARG_TYPE_INFO(0, options, IS_ARRAY, 0) ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Manager_executeBulkWrite, 0, 2, MongoDB\\Driver\\WriteResult, 0) ZEND_ARG_TYPE_INFO(0, namespace, IS_STRING, 0) ZEND_ARG_OBJ_INFO(0, bulk, MongoDB\\Driver\\BulkWrite, 0) ZEND_ARG_OBJ_TYPE_MASK(0, options, MongoDB\\Driver\\WriteConcern, MAY_BE_ARRAY|MAY_BE_NULL, "null") ZEND_END_ARG_INFO() -#endif -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Manager_executeBulkWrite, 0, 2, MongoDB\\Driver\\WriteResult, 0) - ZEND_ARG_TYPE_INFO(0, namespace, IS_STRING, 0) - ZEND_ARG_OBJ_INFO(0, bulk, MongoDB\\Driver\\BulkWrite, 0) - ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, options, "null") -ZEND_END_ARG_INFO() -#endif - -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Manager_executeCommand, 0, 2, MongoDB\\Driver\\Cursor, 0) ZEND_ARG_TYPE_INFO(0, db, IS_STRING, 0) ZEND_ARG_OBJ_INFO(0, command, MongoDB\\Driver\\Command, 0) ZEND_ARG_OBJ_TYPE_MASK(0, options, MongoDB\\Driver\\ReadPreference, MAY_BE_ARRAY|MAY_BE_NULL, "null") ZEND_END_ARG_INFO() -#endif -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Manager_executeCommand, 0, 2, MongoDB\\Driver\\Cursor, 0) - ZEND_ARG_TYPE_INFO(0, db, IS_STRING, 0) - ZEND_ARG_OBJ_INFO(0, command, MongoDB\\Driver\\Command, 0) - ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, options, "null") -ZEND_END_ARG_INFO() -#endif - -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Manager_executeQuery, 0, 2, MongoDB\\Driver\\Cursor, 0) ZEND_ARG_TYPE_INFO(0, namespace, IS_STRING, 0) ZEND_ARG_OBJ_INFO(0, query, MongoDB\\Driver\\Query, 0) ZEND_ARG_OBJ_TYPE_MASK(0, options, MongoDB\\Driver\\ReadPreference, MAY_BE_ARRAY|MAY_BE_NULL, "null") ZEND_END_ARG_INFO() -#endif - -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Manager_executeQuery, 0, 2, MongoDB\\Driver\\Cursor, 0) - ZEND_ARG_TYPE_INFO(0, namespace, IS_STRING, 0) - ZEND_ARG_OBJ_INFO(0, query, MongoDB\\Driver\\Query, 0) - ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, options, "null") -ZEND_END_ARG_INFO() -#endif ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Manager_executeReadCommand, 0, 2, MongoDB\\Driver\\Cursor, 0) ZEND_ARG_TYPE_INFO(0, db, IS_STRING, 0) @@ -73,15 +43,8 @@ ZEND_END_ARG_INFO() #define arginfo_class_MongoDB_Driver_Manager_executeWriteCommand arginfo_class_MongoDB_Driver_Manager_executeReadCommand -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_class_MongoDB_Driver_Manager_getEncryptedFieldsMap, 0, 0, MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_NULL) ZEND_END_ARG_INFO() -#endif - -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_Manager_getEncryptedFieldsMap, 0, 0, 0) -ZEND_END_ARG_INFO() -#endif ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Manager_getReadConcern, 0, 0, MongoDB\\Driver\\ReadConcern, 0) ZEND_END_ARG_INFO() @@ -109,33 +72,13 @@ ZEND_END_ARG_INFO() static ZEND_METHOD(MongoDB_Driver_Manager, __construct); static ZEND_METHOD(MongoDB_Driver_Manager, addSubscriber); static ZEND_METHOD(MongoDB_Driver_Manager, createClientEncryption); -#if PHP_VERSION_ID >= 80000 -static ZEND_METHOD(MongoDB_Driver_Manager, executeBulkWrite); -#endif -#if !(PHP_VERSION_ID >= 80000) static ZEND_METHOD(MongoDB_Driver_Manager, executeBulkWrite); -#endif -#if PHP_VERSION_ID >= 80000 -static ZEND_METHOD(MongoDB_Driver_Manager, executeCommand); -#endif -#if !(PHP_VERSION_ID >= 80000) static ZEND_METHOD(MongoDB_Driver_Manager, executeCommand); -#endif -#if PHP_VERSION_ID >= 80000 static ZEND_METHOD(MongoDB_Driver_Manager, executeQuery); -#endif -#if !(PHP_VERSION_ID >= 80000) -static ZEND_METHOD(MongoDB_Driver_Manager, executeQuery); -#endif static ZEND_METHOD(MongoDB_Driver_Manager, executeReadCommand); static ZEND_METHOD(MongoDB_Driver_Manager, executeReadWriteCommand); static ZEND_METHOD(MongoDB_Driver_Manager, executeWriteCommand); -#if PHP_VERSION_ID >= 80000 -static ZEND_METHOD(MongoDB_Driver_Manager, getEncryptedFieldsMap); -#endif -#if !(PHP_VERSION_ID >= 80000) static ZEND_METHOD(MongoDB_Driver_Manager, getEncryptedFieldsMap); -#endif static ZEND_METHOD(MongoDB_Driver_Manager, getReadConcern); static ZEND_METHOD(MongoDB_Driver_Manager, getReadPreference); static ZEND_METHOD(MongoDB_Driver_Manager, getServers); @@ -149,33 +92,13 @@ static const zend_function_entry class_MongoDB_Driver_Manager_methods[] = { ZEND_ME(MongoDB_Driver_Manager, __construct, arginfo_class_MongoDB_Driver_Manager___construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_Driver_Manager, addSubscriber, arginfo_class_MongoDB_Driver_Manager_addSubscriber, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_Driver_Manager, createClientEncryption, arginfo_class_MongoDB_Driver_Manager_createClientEncryption, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#if PHP_VERSION_ID >= 80000 - ZEND_ME(MongoDB_Driver_Manager, executeBulkWrite, arginfo_class_MongoDB_Driver_Manager_executeBulkWrite, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if !(PHP_VERSION_ID >= 80000) ZEND_ME(MongoDB_Driver_Manager, executeBulkWrite, arginfo_class_MongoDB_Driver_Manager_executeBulkWrite, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if PHP_VERSION_ID >= 80000 ZEND_ME(MongoDB_Driver_Manager, executeCommand, arginfo_class_MongoDB_Driver_Manager_executeCommand, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if !(PHP_VERSION_ID >= 80000) - ZEND_ME(MongoDB_Driver_Manager, executeCommand, arginfo_class_MongoDB_Driver_Manager_executeCommand, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if PHP_VERSION_ID >= 80000 - ZEND_ME(MongoDB_Driver_Manager, executeQuery, arginfo_class_MongoDB_Driver_Manager_executeQuery, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if !(PHP_VERSION_ID >= 80000) ZEND_ME(MongoDB_Driver_Manager, executeQuery, arginfo_class_MongoDB_Driver_Manager_executeQuery, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif ZEND_ME(MongoDB_Driver_Manager, executeReadCommand, arginfo_class_MongoDB_Driver_Manager_executeReadCommand, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_Driver_Manager, executeReadWriteCommand, arginfo_class_MongoDB_Driver_Manager_executeReadWriteCommand, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_Driver_Manager, executeWriteCommand, arginfo_class_MongoDB_Driver_Manager_executeWriteCommand, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#if PHP_VERSION_ID >= 80000 - ZEND_ME(MongoDB_Driver_Manager, getEncryptedFieldsMap, arginfo_class_MongoDB_Driver_Manager_getEncryptedFieldsMap, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if !(PHP_VERSION_ID >= 80000) ZEND_ME(MongoDB_Driver_Manager, getEncryptedFieldsMap, arginfo_class_MongoDB_Driver_Manager_getEncryptedFieldsMap, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif ZEND_ME(MongoDB_Driver_Manager, getReadConcern, arginfo_class_MongoDB_Driver_Manager_getReadConcern, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_Driver_Manager, getReadPreference, arginfo_class_MongoDB_Driver_Manager_getReadPreference, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_Driver_Manager, getServers, arginfo_class_MongoDB_Driver_Manager_getServers, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) @@ -192,7 +115,7 @@ static zend_class_entry *register_class_MongoDB_Driver_Manager(void) INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "Manager", class_MongoDB_Driver_Manager_methods); class_entry = zend_register_internal_class_ex(&ce, NULL); - class_entry->ce_flags |= ZEND_ACC_FINAL; + class_entry->ce_flags |= ZEND_ACC_FINAL|ZEND_ACC_NOT_SERIALIZABLE; return class_entry; } diff --git a/src/MongoDB/Monitoring/CommandFailedEvent.c b/src/MongoDB/Monitoring/CommandFailedEvent.c index 75a8e3e2e..9c336d705 100644 --- a/src/MongoDB/Monitoring/CommandFailedEvent.c +++ b/src/MongoDB/Monitoring/CommandFailedEvent.c @@ -222,7 +222,7 @@ static zend_object* php_phongo_commandfailedevent_create_object(zend_class_entry return &intern->std; } -static HashTable* php_phongo_commandfailedevent_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) +static HashTable* php_phongo_commandfailedevent_get_debug_info(zend_object* object, int* is_temp) { php_phongo_commandfailedevent_t* intern; zval retval = ZVAL_STATIC_INIT; @@ -231,7 +231,7 @@ static HashTable* php_phongo_commandfailedevent_get_debug_info(phongo_compat_obj PHONGO_BSON_INIT_STATE(reply_state); - intern = Z_OBJ_COMMANDFAILEDEVENT(PHONGO_COMPAT_GET_OBJ(object)); + intern = Z_OBJ_COMMANDFAILEDEVENT(object); *is_temp = 1; array_init_size(&retval, 6); @@ -289,7 +289,6 @@ void php_phongo_commandfailedevent_init_ce(INIT_FUNC_ARGS) { php_phongo_commandfailedevent_ce = register_class_MongoDB_Driver_Monitoring_CommandFailedEvent(); php_phongo_commandfailedevent_ce->create_object = php_phongo_commandfailedevent_create_object; - PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_commandfailedevent_ce); memcpy(&php_phongo_handler_commandfailedevent, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); php_phongo_handler_commandfailedevent.get_debug_info = php_phongo_commandfailedevent_get_debug_info; diff --git a/src/MongoDB/Monitoring/CommandFailedEvent.stub.php b/src/MongoDB/Monitoring/CommandFailedEvent.stub.php index 9c8c9041b..b93534f5b 100644 --- a/src/MongoDB/Monitoring/CommandFailedEvent.stub.php +++ b/src/MongoDB/Monitoring/CommandFailedEvent.stub.php @@ -7,6 +7,7 @@ namespace MongoDB\Driver\Monitoring; +/** @not-serializable */ final class CommandFailedEvent { final private function __construct() {} diff --git a/src/MongoDB/Monitoring/CommandFailedEvent_arginfo.h b/src/MongoDB/Monitoring/CommandFailedEvent_arginfo.h index d193f7075..37f37efca 100644 --- a/src/MongoDB/Monitoring/CommandFailedEvent_arginfo.h +++ b/src/MongoDB/Monitoring/CommandFailedEvent_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 6fd7c6597ad8e67b399cf4e7c41bb6cc5e6666d6 */ + * Stub hash: a66722614a1820947312559a1e57991c488487b7 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_Monitoring_CommandFailedEvent___construct, 0, 0, 0) ZEND_END_ARG_INFO() @@ -66,7 +66,7 @@ static zend_class_entry *register_class_MongoDB_Driver_Monitoring_CommandFailedE INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver\\Monitoring", "CommandFailedEvent", class_MongoDB_Driver_Monitoring_CommandFailedEvent_methods); class_entry = zend_register_internal_class_ex(&ce, NULL); - class_entry->ce_flags |= ZEND_ACC_FINAL; + class_entry->ce_flags |= ZEND_ACC_FINAL|ZEND_ACC_NOT_SERIALIZABLE; return class_entry; } diff --git a/src/MongoDB/Monitoring/CommandStartedEvent.c b/src/MongoDB/Monitoring/CommandStartedEvent.c index f45159e8c..3a7398cf6 100644 --- a/src/MongoDB/Monitoring/CommandStartedEvent.c +++ b/src/MongoDB/Monitoring/CommandStartedEvent.c @@ -194,7 +194,7 @@ static zend_object* php_phongo_commandstartedevent_create_object(zend_class_entr return &intern->std; } -static HashTable* php_phongo_commandstartedevent_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) +static HashTable* php_phongo_commandstartedevent_get_debug_info(zend_object* object, int* is_temp) { php_phongo_commandstartedevent_t* intern; zval retval = ZVAL_STATIC_INIT; @@ -203,7 +203,7 @@ static HashTable* php_phongo_commandstartedevent_get_debug_info(phongo_compat_ob PHONGO_BSON_INIT_STATE(command_state); - intern = Z_OBJ_COMMANDSTARTEDEVENT(PHONGO_COMPAT_GET_OBJ(object)); + intern = Z_OBJ_COMMANDSTARTEDEVENT(object); *is_temp = 1; array_init_size(&retval, 6); @@ -258,7 +258,6 @@ void php_phongo_commandstartedevent_init_ce(INIT_FUNC_ARGS) { php_phongo_commandstartedevent_ce = register_class_MongoDB_Driver_Monitoring_CommandStartedEvent(); php_phongo_commandstartedevent_ce->create_object = php_phongo_commandstartedevent_create_object; - PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_commandstartedevent_ce); memcpy(&php_phongo_handler_commandstartedevent, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); php_phongo_handler_commandstartedevent.get_debug_info = php_phongo_commandstartedevent_get_debug_info; diff --git a/src/MongoDB/Monitoring/CommandStartedEvent.stub.php b/src/MongoDB/Monitoring/CommandStartedEvent.stub.php index c3dbf3718..2250f645f 100644 --- a/src/MongoDB/Monitoring/CommandStartedEvent.stub.php +++ b/src/MongoDB/Monitoring/CommandStartedEvent.stub.php @@ -7,6 +7,7 @@ namespace MongoDB\Driver\Monitoring; +/** @not-serializable */ final class CommandStartedEvent { final private function __construct() {} diff --git a/src/MongoDB/Monitoring/CommandStartedEvent_arginfo.h b/src/MongoDB/Monitoring/CommandStartedEvent_arginfo.h index f52bb79e1..67f0c7e36 100644 --- a/src/MongoDB/Monitoring/CommandStartedEvent_arginfo.h +++ b/src/MongoDB/Monitoring/CommandStartedEvent_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 4ff134c852d47ac645fcc505d3b9319eb46a3899 */ + * Stub hash: e9ab096bf221da9e3ea2e28b50637e3937edeb1e */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_Monitoring_CommandStartedEvent___construct, 0, 0, 0) ZEND_END_ARG_INFO() @@ -56,7 +56,7 @@ static zend_class_entry *register_class_MongoDB_Driver_Monitoring_CommandStarted INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver\\Monitoring", "CommandStartedEvent", class_MongoDB_Driver_Monitoring_CommandStartedEvent_methods); class_entry = zend_register_internal_class_ex(&ce, NULL); - class_entry->ce_flags |= ZEND_ACC_FINAL; + class_entry->ce_flags |= ZEND_ACC_FINAL|ZEND_ACC_NOT_SERIALIZABLE; return class_entry; } diff --git a/src/MongoDB/Monitoring/CommandSucceededEvent.c b/src/MongoDB/Monitoring/CommandSucceededEvent.c index e635850a1..dd0a13f98 100644 --- a/src/MongoDB/Monitoring/CommandSucceededEvent.c +++ b/src/MongoDB/Monitoring/CommandSucceededEvent.c @@ -206,7 +206,7 @@ static zend_object* php_phongo_commandsucceededevent_create_object(zend_class_en return &intern->std; } -static HashTable* php_phongo_commandsucceededevent_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) +static HashTable* php_phongo_commandsucceededevent_get_debug_info(zend_object* object, int* is_temp) { php_phongo_commandsucceededevent_t* intern; zval retval = ZVAL_STATIC_INIT; @@ -215,7 +215,7 @@ static HashTable* php_phongo_commandsucceededevent_get_debug_info(phongo_compat_ PHONGO_BSON_INIT_STATE(reply_state); - intern = Z_OBJ_COMMANDSUCCEEDEDEVENT(PHONGO_COMPAT_GET_OBJ(object)); + intern = Z_OBJ_COMMANDSUCCEEDEDEVENT(object); *is_temp = 1; array_init_size(&retval, 6); @@ -270,7 +270,6 @@ void php_phongo_commandsucceededevent_init_ce(INIT_FUNC_ARGS) { php_phongo_commandsucceededevent_ce = register_class_MongoDB_Driver_Monitoring_CommandSucceededEvent(); php_phongo_commandsucceededevent_ce->create_object = php_phongo_commandsucceededevent_create_object; - PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_commandsucceededevent_ce); memcpy(&php_phongo_handler_commandsucceededevent, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); php_phongo_handler_commandsucceededevent.get_debug_info = php_phongo_commandsucceededevent_get_debug_info; diff --git a/src/MongoDB/Monitoring/CommandSucceededEvent.stub.php b/src/MongoDB/Monitoring/CommandSucceededEvent.stub.php index e671c06b6..6106ecc9b 100644 --- a/src/MongoDB/Monitoring/CommandSucceededEvent.stub.php +++ b/src/MongoDB/Monitoring/CommandSucceededEvent.stub.php @@ -7,6 +7,7 @@ namespace MongoDB\Driver\Monitoring; +/** @not-serializable */ final class CommandSucceededEvent { final private function __construct() {} diff --git a/src/MongoDB/Monitoring/CommandSucceededEvent_arginfo.h b/src/MongoDB/Monitoring/CommandSucceededEvent_arginfo.h index 8ccdb3bb5..81e4282ad 100644 --- a/src/MongoDB/Monitoring/CommandSucceededEvent_arginfo.h +++ b/src/MongoDB/Monitoring/CommandSucceededEvent_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 86e4fd7aeffe8b4d03c32f4221450d80b3f322a9 */ + * Stub hash: 250ca17ac4e7719f801fec8e2721b85d67ea6e06 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_Monitoring_CommandSucceededEvent___construct, 0, 0, 0) ZEND_END_ARG_INFO() @@ -61,7 +61,7 @@ static zend_class_entry *register_class_MongoDB_Driver_Monitoring_CommandSucceed INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver\\Monitoring", "CommandSucceededEvent", class_MongoDB_Driver_Monitoring_CommandSucceededEvent_methods); class_entry = zend_register_internal_class_ex(&ce, NULL); - class_entry->ce_flags |= ZEND_ACC_FINAL; + class_entry->ce_flags |= ZEND_ACC_FINAL|ZEND_ACC_NOT_SERIALIZABLE; return class_entry; } diff --git a/src/MongoDB/Monitoring/ServerChangedEvent.c b/src/MongoDB/Monitoring/ServerChangedEvent.c index 2ccd33fde..065f2baee 100644 --- a/src/MongoDB/Monitoring/ServerChangedEvent.c +++ b/src/MongoDB/Monitoring/ServerChangedEvent.c @@ -111,12 +111,12 @@ static zend_object* php_phongo_serverchangedevent_create_object(zend_class_entry return &intern->std; } -static HashTable* php_phongo_serverchangedevent_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) +static HashTable* php_phongo_serverchangedevent_get_debug_info(zend_object* object, int* is_temp) { php_phongo_serverchangedevent_t* intern; zval retval = ZVAL_STATIC_INIT; - intern = Z_OBJ_SERVERCHANGEDEVENT(PHONGO_COMPAT_GET_OBJ(object)); + intern = Z_OBJ_SERVERCHANGEDEVENT(object); *is_temp = 1; array_init_size(&retval, 4); @@ -154,7 +154,6 @@ void php_phongo_serverchangedevent_init_ce(INIT_FUNC_ARGS) { php_phongo_serverchangedevent_ce = register_class_MongoDB_Driver_Monitoring_ServerChangedEvent(); php_phongo_serverchangedevent_ce->create_object = php_phongo_serverchangedevent_create_object; - PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_serverchangedevent_ce); memcpy(&php_phongo_handler_serverchangedevent, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); php_phongo_handler_serverchangedevent.get_debug_info = php_phongo_serverchangedevent_get_debug_info; diff --git a/src/MongoDB/Monitoring/ServerChangedEvent.stub.php b/src/MongoDB/Monitoring/ServerChangedEvent.stub.php index 866301915..901f9a9b8 100644 --- a/src/MongoDB/Monitoring/ServerChangedEvent.stub.php +++ b/src/MongoDB/Monitoring/ServerChangedEvent.stub.php @@ -7,6 +7,7 @@ namespace MongoDB\Driver\Monitoring; +/** @not-serializable */ final class ServerChangedEvent { final private function __construct() {} diff --git a/src/MongoDB/Monitoring/ServerChangedEvent_arginfo.h b/src/MongoDB/Monitoring/ServerChangedEvent_arginfo.h index 02c2c00ea..ed0f71eeb 100644 --- a/src/MongoDB/Monitoring/ServerChangedEvent_arginfo.h +++ b/src/MongoDB/Monitoring/ServerChangedEvent_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: ceda7306bdc50f59b0f663cd5a0a76fff7236a25 */ + * Stub hash: d681e2e9936f0846fe8ee7fa6eb25bb218d85902 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_Monitoring_ServerChangedEvent___construct, 0, 0, 0) ZEND_END_ARG_INFO() @@ -43,7 +43,7 @@ static zend_class_entry *register_class_MongoDB_Driver_Monitoring_ServerChangedE INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver\\Monitoring", "ServerChangedEvent", class_MongoDB_Driver_Monitoring_ServerChangedEvent_methods); class_entry = zend_register_internal_class_ex(&ce, NULL); - class_entry->ce_flags |= ZEND_ACC_FINAL; + class_entry->ce_flags |= ZEND_ACC_FINAL|ZEND_ACC_NOT_SERIALIZABLE; return class_entry; } diff --git a/src/MongoDB/Monitoring/ServerClosedEvent.c b/src/MongoDB/Monitoring/ServerClosedEvent.c index 1041471e3..b540125ba 100644 --- a/src/MongoDB/Monitoring/ServerClosedEvent.c +++ b/src/MongoDB/Monitoring/ServerClosedEvent.c @@ -79,12 +79,12 @@ static zend_object* php_phongo_serverclosedevent_create_object(zend_class_entry* return &intern->std; } -static HashTable* php_phongo_serverclosedevent_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) +static HashTable* php_phongo_serverclosedevent_get_debug_info(zend_object* object, int* is_temp) { php_phongo_serverclosedevent_t* intern; zval retval = ZVAL_STATIC_INIT; - intern = Z_OBJ_SERVERCLOSEDEVENT(PHONGO_COMPAT_GET_OBJ(object)); + intern = Z_OBJ_SERVERCLOSEDEVENT(object); *is_temp = 1; array_init_size(&retval, 3); @@ -110,7 +110,6 @@ void php_phongo_serverclosedevent_init_ce(INIT_FUNC_ARGS) { php_phongo_serverclosedevent_ce = register_class_MongoDB_Driver_Monitoring_ServerClosedEvent(); php_phongo_serverclosedevent_ce->create_object = php_phongo_serverclosedevent_create_object; - PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_serverclosedevent_ce); memcpy(&php_phongo_handler_serverclosedevent, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); php_phongo_handler_serverclosedevent.get_debug_info = php_phongo_serverclosedevent_get_debug_info; diff --git a/src/MongoDB/Monitoring/ServerClosedEvent.stub.php b/src/MongoDB/Monitoring/ServerClosedEvent.stub.php index 750f983f9..5ff5ad9e3 100644 --- a/src/MongoDB/Monitoring/ServerClosedEvent.stub.php +++ b/src/MongoDB/Monitoring/ServerClosedEvent.stub.php @@ -7,6 +7,7 @@ namespace MongoDB\Driver\Monitoring; +/** @not-serializable */ final class ServerClosedEvent { final private function __construct() {} diff --git a/src/MongoDB/Monitoring/ServerClosedEvent_arginfo.h b/src/MongoDB/Monitoring/ServerClosedEvent_arginfo.h index 18d80e2bb..aaa2cc10c 100644 --- a/src/MongoDB/Monitoring/ServerClosedEvent_arginfo.h +++ b/src/MongoDB/Monitoring/ServerClosedEvent_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: ea43e62ce17ddb00625fdf165187fa4997867e4d */ + * Stub hash: 05a48b4966fb49c82a6ef48b360a93fdc2919f77 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_Monitoring_ServerClosedEvent___construct, 0, 0, 0) ZEND_END_ARG_INFO() @@ -34,7 +34,7 @@ static zend_class_entry *register_class_MongoDB_Driver_Monitoring_ServerClosedEv INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver\\Monitoring", "ServerClosedEvent", class_MongoDB_Driver_Monitoring_ServerClosedEvent_methods); class_entry = zend_register_internal_class_ex(&ce, NULL); - class_entry->ce_flags |= ZEND_ACC_FINAL; + class_entry->ce_flags |= ZEND_ACC_FINAL|ZEND_ACC_NOT_SERIALIZABLE; return class_entry; } diff --git a/src/MongoDB/Monitoring/ServerHeartbeatFailedEvent.c b/src/MongoDB/Monitoring/ServerHeartbeatFailedEvent.c index d2997fa71..b20b022d5 100644 --- a/src/MongoDB/Monitoring/ServerHeartbeatFailedEvent.c +++ b/src/MongoDB/Monitoring/ServerHeartbeatFailedEvent.c @@ -101,12 +101,12 @@ static zend_object* php_phongo_serverheartbeatfailedevent_create_object(zend_cla return &intern->std; } -static HashTable* php_phongo_serverheartbeatfailedevent_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) +static HashTable* php_phongo_serverheartbeatfailedevent_get_debug_info(zend_object* object, int* is_temp) { php_phongo_serverheartbeatfailedevent_t* intern; zval retval = ZVAL_STATIC_INIT; - intern = Z_OBJ_SERVERHEARTBEATFAILEDEVENT(PHONGO_COMPAT_GET_OBJ(object)); + intern = Z_OBJ_SERVERHEARTBEATFAILEDEVENT(object); *is_temp = 1; array_init_size(&retval, 5); @@ -125,7 +125,6 @@ void php_phongo_serverheartbeatfailedevent_init_ce(INIT_FUNC_ARGS) { php_phongo_serverheartbeatfailedevent_ce = register_class_MongoDB_Driver_Monitoring_ServerHeartbeatFailedEvent(); php_phongo_serverheartbeatfailedevent_ce->create_object = php_phongo_serverheartbeatfailedevent_create_object; - PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_serverheartbeatfailedevent_ce); memcpy(&php_phongo_handler_serverheartbeatfailedevent, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); php_phongo_handler_serverheartbeatfailedevent.get_debug_info = php_phongo_serverheartbeatfailedevent_get_debug_info; diff --git a/src/MongoDB/Monitoring/ServerHeartbeatFailedEvent.stub.php b/src/MongoDB/Monitoring/ServerHeartbeatFailedEvent.stub.php index f4ea11deb..cb40abe4f 100644 --- a/src/MongoDB/Monitoring/ServerHeartbeatFailedEvent.stub.php +++ b/src/MongoDB/Monitoring/ServerHeartbeatFailedEvent.stub.php @@ -7,6 +7,7 @@ namespace MongoDB\Driver\Monitoring; +/** @not-serializable */ final class ServerHeartbeatFailedEvent { final private function __construct() {} diff --git a/src/MongoDB/Monitoring/ServerHeartbeatFailedEvent_arginfo.h b/src/MongoDB/Monitoring/ServerHeartbeatFailedEvent_arginfo.h index f918fd64f..1cc721608 100644 --- a/src/MongoDB/Monitoring/ServerHeartbeatFailedEvent_arginfo.h +++ b/src/MongoDB/Monitoring/ServerHeartbeatFailedEvent_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: ac66509ce4aa08f433f90d4cddd406172995531e */ + * Stub hash: ba0a81f27f99579e332ef8d3a3a477b3ebe1ec31 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_Monitoring_ServerHeartbeatFailedEvent___construct, 0, 0, 0) ZEND_END_ARG_INFO() @@ -43,7 +43,7 @@ static zend_class_entry *register_class_MongoDB_Driver_Monitoring_ServerHeartbea INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver\\Monitoring", "ServerHeartbeatFailedEvent", class_MongoDB_Driver_Monitoring_ServerHeartbeatFailedEvent_methods); class_entry = zend_register_internal_class_ex(&ce, NULL); - class_entry->ce_flags |= ZEND_ACC_FINAL; + class_entry->ce_flags |= ZEND_ACC_FINAL|ZEND_ACC_NOT_SERIALIZABLE; return class_entry; } diff --git a/src/MongoDB/Monitoring/ServerHeartbeatStartedEvent.c b/src/MongoDB/Monitoring/ServerHeartbeatStartedEvent.c index 167eab4ca..0df11d1d0 100644 --- a/src/MongoDB/Monitoring/ServerHeartbeatStartedEvent.c +++ b/src/MongoDB/Monitoring/ServerHeartbeatStartedEvent.c @@ -77,12 +77,12 @@ static zend_object* php_phongo_serverheartbeatstartedevent_create_object(zend_cl return &intern->std; } -static HashTable* php_phongo_serverheartbeatstartedevent_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) +static HashTable* php_phongo_serverheartbeatstartedevent_get_debug_info(zend_object* object, int* is_temp) { php_phongo_serverheartbeatstartedevent_t* intern; zval retval = ZVAL_STATIC_INIT; - intern = Z_OBJ_SERVERHEARTBEATSTARTEDEVENT(PHONGO_COMPAT_GET_OBJ(object)); + intern = Z_OBJ_SERVERHEARTBEATSTARTEDEVENT(object); *is_temp = 1; array_init_size(&retval, 4); @@ -97,7 +97,6 @@ void php_phongo_serverheartbeatstartedevent_init_ce(INIT_FUNC_ARGS) { php_phongo_serverheartbeatstartedevent_ce = register_class_MongoDB_Driver_Monitoring_ServerHeartbeatStartedEvent(); php_phongo_serverheartbeatstartedevent_ce->create_object = php_phongo_serverheartbeatstartedevent_create_object; - PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_serverheartbeatstartedevent_ce); memcpy(&php_phongo_handler_serverheartbeatstartedevent, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); php_phongo_handler_serverheartbeatstartedevent.get_debug_info = php_phongo_serverheartbeatstartedevent_get_debug_info; diff --git a/src/MongoDB/Monitoring/ServerHeartbeatStartedEvent.stub.php b/src/MongoDB/Monitoring/ServerHeartbeatStartedEvent.stub.php index 8a5252a75..4b77b2944 100644 --- a/src/MongoDB/Monitoring/ServerHeartbeatStartedEvent.stub.php +++ b/src/MongoDB/Monitoring/ServerHeartbeatStartedEvent.stub.php @@ -7,6 +7,7 @@ namespace MongoDB\Driver\Monitoring; +/** @not-serializable */ final class ServerHeartbeatStartedEvent { final private function __construct() {} diff --git a/src/MongoDB/Monitoring/ServerHeartbeatStartedEvent_arginfo.h b/src/MongoDB/Monitoring/ServerHeartbeatStartedEvent_arginfo.h index 21c87e7a5..505067e7e 100644 --- a/src/MongoDB/Monitoring/ServerHeartbeatStartedEvent_arginfo.h +++ b/src/MongoDB/Monitoring/ServerHeartbeatStartedEvent_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 3a921eb2828a6b6e23d0ed16944b6e20894a9fe2 */ + * Stub hash: 7cb420cf908d682f770a9dbc20473e075af9ce53 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_Monitoring_ServerHeartbeatStartedEvent___construct, 0, 0, 0) ZEND_END_ARG_INFO() @@ -34,7 +34,7 @@ static zend_class_entry *register_class_MongoDB_Driver_Monitoring_ServerHeartbea INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver\\Monitoring", "ServerHeartbeatStartedEvent", class_MongoDB_Driver_Monitoring_ServerHeartbeatStartedEvent_methods); class_entry = zend_register_internal_class_ex(&ce, NULL); - class_entry->ce_flags |= ZEND_ACC_FINAL; + class_entry->ce_flags |= ZEND_ACC_FINAL|ZEND_ACC_NOT_SERIALIZABLE; return class_entry; } diff --git a/src/MongoDB/Monitoring/ServerHeartbeatSucceededEvent.c b/src/MongoDB/Monitoring/ServerHeartbeatSucceededEvent.c index 8101c6e6f..d8e213b39 100644 --- a/src/MongoDB/Monitoring/ServerHeartbeatSucceededEvent.c +++ b/src/MongoDB/Monitoring/ServerHeartbeatSucceededEvent.c @@ -109,7 +109,7 @@ static zend_object* php_phongo_serverheartbeatsucceededevent_create_object(zend_ return &intern->std; } -static HashTable* php_phongo_serverheartbeatsucceededevent_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) +static HashTable* php_phongo_serverheartbeatsucceededevent_get_debug_info(zend_object* object, int* is_temp) { php_phongo_serverheartbeatsucceededevent_t* intern; zval retval = ZVAL_STATIC_INIT; @@ -117,7 +117,7 @@ static HashTable* php_phongo_serverheartbeatsucceededevent_get_debug_info(phongo PHONGO_BSON_INIT_STATE(reply_state); - intern = Z_OBJ_SERVERHEARTBEATSUCCEEDEDEVENT(PHONGO_COMPAT_GET_OBJ(object)); + intern = Z_OBJ_SERVERHEARTBEATSUCCEEDEDEVENT(object); *is_temp = 1; array_init_size(&retval, 4); @@ -141,7 +141,6 @@ void php_phongo_serverheartbeatsucceededevent_init_ce(INIT_FUNC_ARGS) { php_phongo_serverheartbeatsucceededevent_ce = register_class_MongoDB_Driver_Monitoring_ServerHeartbeatSucceededEvent(); php_phongo_serverheartbeatsucceededevent_ce->create_object = php_phongo_serverheartbeatsucceededevent_create_object; - PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_serverheartbeatsucceededevent_ce); memcpy(&php_phongo_handler_serverheartbeatsucceededevent, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); php_phongo_handler_serverheartbeatsucceededevent.get_debug_info = php_phongo_serverheartbeatsucceededevent_get_debug_info; diff --git a/src/MongoDB/Monitoring/ServerHeartbeatSucceededEvent.stub.php b/src/MongoDB/Monitoring/ServerHeartbeatSucceededEvent.stub.php index 9f3d00d4c..14f28efe2 100644 --- a/src/MongoDB/Monitoring/ServerHeartbeatSucceededEvent.stub.php +++ b/src/MongoDB/Monitoring/ServerHeartbeatSucceededEvent.stub.php @@ -7,6 +7,7 @@ namespace MongoDB\Driver\Monitoring; +/** @not-serializable */ final class ServerHeartbeatSucceededEvent { final private function __construct() {} diff --git a/src/MongoDB/Monitoring/ServerHeartbeatSucceededEvent_arginfo.h b/src/MongoDB/Monitoring/ServerHeartbeatSucceededEvent_arginfo.h index a488f3b65..324b1dd66 100644 --- a/src/MongoDB/Monitoring/ServerHeartbeatSucceededEvent_arginfo.h +++ b/src/MongoDB/Monitoring/ServerHeartbeatSucceededEvent_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 2ebe6d49f71f28d7e5971296c6601a52660a6682 */ + * Stub hash: dce5c76853a5c0a532be89796806527d37d018a1 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_Monitoring_ServerHeartbeatSucceededEvent___construct, 0, 0, 0) ZEND_END_ARG_INFO() @@ -43,7 +43,7 @@ static zend_class_entry *register_class_MongoDB_Driver_Monitoring_ServerHeartbea INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver\\Monitoring", "ServerHeartbeatSucceededEvent", class_MongoDB_Driver_Monitoring_ServerHeartbeatSucceededEvent_methods); class_entry = zend_register_internal_class_ex(&ce, NULL); - class_entry->ce_flags |= ZEND_ACC_FINAL; + class_entry->ce_flags |= ZEND_ACC_FINAL|ZEND_ACC_NOT_SERIALIZABLE; return class_entry; } diff --git a/src/MongoDB/Monitoring/ServerOpeningEvent.c b/src/MongoDB/Monitoring/ServerOpeningEvent.c index eef5006a5..ba8e53119 100644 --- a/src/MongoDB/Monitoring/ServerOpeningEvent.c +++ b/src/MongoDB/Monitoring/ServerOpeningEvent.c @@ -79,12 +79,12 @@ static zend_object* php_phongo_serveropeningevent_create_object(zend_class_entry return &intern->std; } -static HashTable* php_phongo_serveropeningevent_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) +static HashTable* php_phongo_serveropeningevent_get_debug_info(zend_object* object, int* is_temp) { php_phongo_serveropeningevent_t* intern; zval retval = ZVAL_STATIC_INIT; - intern = Z_OBJ_SERVEROPENINGEVENT(PHONGO_COMPAT_GET_OBJ(object)); + intern = Z_OBJ_SERVEROPENINGEVENT(object); *is_temp = 1; array_init_size(&retval, 3); @@ -110,7 +110,6 @@ void php_phongo_serveropeningevent_init_ce(INIT_FUNC_ARGS) { php_phongo_serveropeningevent_ce = register_class_MongoDB_Driver_Monitoring_ServerOpeningEvent(); php_phongo_serveropeningevent_ce->create_object = php_phongo_serveropeningevent_create_object; - PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_serveropeningevent_ce); memcpy(&php_phongo_handler_serveropeningevent, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); php_phongo_handler_serveropeningevent.get_debug_info = php_phongo_serveropeningevent_get_debug_info; diff --git a/src/MongoDB/Monitoring/ServerOpeningEvent.stub.php b/src/MongoDB/Monitoring/ServerOpeningEvent.stub.php index 9ab052f22..c3cfa3ba5 100644 --- a/src/MongoDB/Monitoring/ServerOpeningEvent.stub.php +++ b/src/MongoDB/Monitoring/ServerOpeningEvent.stub.php @@ -7,6 +7,7 @@ namespace MongoDB\Driver\Monitoring; +/** @not-serializable */ final class ServerOpeningEvent { final private function __construct() {} diff --git a/src/MongoDB/Monitoring/ServerOpeningEvent_arginfo.h b/src/MongoDB/Monitoring/ServerOpeningEvent_arginfo.h index d2526f81b..c5b047d65 100644 --- a/src/MongoDB/Monitoring/ServerOpeningEvent_arginfo.h +++ b/src/MongoDB/Monitoring/ServerOpeningEvent_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: ff0ed638bd5aa4f82216a9af2fc22743c39d2a2b */ + * Stub hash: 017f3508070fe14083d8839f97ad0d6788470639 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_Monitoring_ServerOpeningEvent___construct, 0, 0, 0) ZEND_END_ARG_INFO() @@ -34,7 +34,7 @@ static zend_class_entry *register_class_MongoDB_Driver_Monitoring_ServerOpeningE INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver\\Monitoring", "ServerOpeningEvent", class_MongoDB_Driver_Monitoring_ServerOpeningEvent_methods); class_entry = zend_register_internal_class_ex(&ce, NULL); - class_entry->ce_flags |= ZEND_ACC_FINAL; + class_entry->ce_flags |= ZEND_ACC_FINAL|ZEND_ACC_NOT_SERIALIZABLE; return class_entry; } diff --git a/src/MongoDB/Monitoring/TopologyChangedEvent.c b/src/MongoDB/Monitoring/TopologyChangedEvent.c index c80ad060c..ac44c124b 100644 --- a/src/MongoDB/Monitoring/TopologyChangedEvent.c +++ b/src/MongoDB/Monitoring/TopologyChangedEvent.c @@ -90,12 +90,12 @@ static zend_object* php_phongo_topologychangedevent_create_object(zend_class_ent return &intern->std; } -static HashTable* php_phongo_topologychangedevent_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) +static HashTable* php_phongo_topologychangedevent_get_debug_info(zend_object* object, int* is_temp) { php_phongo_topologychangedevent_t* intern; zval retval = ZVAL_STATIC_INIT; - intern = Z_OBJ_TOPOLOGYCHANGEDEVENT(PHONGO_COMPAT_GET_OBJ(object)); + intern = Z_OBJ_TOPOLOGYCHANGEDEVENT(object); *is_temp = 1; array_init_size(&retval, 3); @@ -130,7 +130,6 @@ void php_phongo_topologychangedevent_init_ce(INIT_FUNC_ARGS) { php_phongo_topologychangedevent_ce = register_class_MongoDB_Driver_Monitoring_TopologyChangedEvent(); php_phongo_topologychangedevent_ce->create_object = php_phongo_topologychangedevent_create_object; - PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_topologychangedevent_ce); memcpy(&php_phongo_handler_topologychangedevent, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); php_phongo_handler_topologychangedevent.get_debug_info = php_phongo_topologychangedevent_get_debug_info; diff --git a/src/MongoDB/Monitoring/TopologyChangedEvent.stub.php b/src/MongoDB/Monitoring/TopologyChangedEvent.stub.php index 442a6cff1..d2120aad4 100644 --- a/src/MongoDB/Monitoring/TopologyChangedEvent.stub.php +++ b/src/MongoDB/Monitoring/TopologyChangedEvent.stub.php @@ -7,6 +7,7 @@ namespace MongoDB\Driver\Monitoring; +/** @not-serializable */ final class TopologyChangedEvent { final private function __construct() {} diff --git a/src/MongoDB/Monitoring/TopologyChangedEvent_arginfo.h b/src/MongoDB/Monitoring/TopologyChangedEvent_arginfo.h index 8ce8f0dc5..23dd674c9 100644 --- a/src/MongoDB/Monitoring/TopologyChangedEvent_arginfo.h +++ b/src/MongoDB/Monitoring/TopologyChangedEvent_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 04aa095fba77e78f9a42f36aa2ea1bbad46a953b */ + * Stub hash: 20071882771d0743a38efc1d7d7d19659cfb637b */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_Monitoring_TopologyChangedEvent___construct, 0, 0, 0) ZEND_END_ARG_INFO() @@ -33,7 +33,7 @@ static zend_class_entry *register_class_MongoDB_Driver_Monitoring_TopologyChange INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver\\Monitoring", "TopologyChangedEvent", class_MongoDB_Driver_Monitoring_TopologyChangedEvent_methods); class_entry = zend_register_internal_class_ex(&ce, NULL); - class_entry->ce_flags |= ZEND_ACC_FINAL; + class_entry->ce_flags |= ZEND_ACC_FINAL|ZEND_ACC_NOT_SERIALIZABLE; return class_entry; } diff --git a/src/MongoDB/Monitoring/TopologyClosedEvent.c b/src/MongoDB/Monitoring/TopologyClosedEvent.c index 102924e4e..383b05097 100644 --- a/src/MongoDB/Monitoring/TopologyClosedEvent.c +++ b/src/MongoDB/Monitoring/TopologyClosedEvent.c @@ -59,12 +59,12 @@ static zend_object* php_phongo_topologyclosedevent_create_object(zend_class_entr return &intern->std; } -static HashTable* php_phongo_topologyclosedevent_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) +static HashTable* php_phongo_topologyclosedevent_get_debug_info(zend_object* object, int* is_temp) { php_phongo_topologyclosedevent_t* intern; zval retval = ZVAL_STATIC_INIT; - intern = Z_OBJ_TOPOLOGYCLOSEDEVENT(PHONGO_COMPAT_GET_OBJ(object)); + intern = Z_OBJ_TOPOLOGYCLOSEDEVENT(object); *is_temp = 1; array_init_size(&retval, 1); @@ -87,7 +87,6 @@ void php_phongo_topologyclosedevent_init_ce(INIT_FUNC_ARGS) { php_phongo_topologyclosedevent_ce = register_class_MongoDB_Driver_Monitoring_TopologyClosedEvent(); php_phongo_topologyclosedevent_ce->create_object = php_phongo_topologyclosedevent_create_object; - PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_topologyclosedevent_ce); memcpy(&php_phongo_handler_topologyclosedevent, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); php_phongo_handler_topologyclosedevent.get_debug_info = php_phongo_topologyclosedevent_get_debug_info; diff --git a/src/MongoDB/Monitoring/TopologyClosedEvent.stub.php b/src/MongoDB/Monitoring/TopologyClosedEvent.stub.php index b3f0983d1..76488a6a8 100644 --- a/src/MongoDB/Monitoring/TopologyClosedEvent.stub.php +++ b/src/MongoDB/Monitoring/TopologyClosedEvent.stub.php @@ -7,6 +7,7 @@ namespace MongoDB\Driver\Monitoring; +/** @not-serializable */ final class TopologyClosedEvent { final private function __construct() {} diff --git a/src/MongoDB/Monitoring/TopologyClosedEvent_arginfo.h b/src/MongoDB/Monitoring/TopologyClosedEvent_arginfo.h index 706287bcf..0fd67337b 100644 --- a/src/MongoDB/Monitoring/TopologyClosedEvent_arginfo.h +++ b/src/MongoDB/Monitoring/TopologyClosedEvent_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 2112d3dfbe44ba8fda6616c97de51e20a66e23e8 */ + * Stub hash: c636ee276d6ebc18186a6ef4b8f67c48f5b4c29c */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_Monitoring_TopologyClosedEvent___construct, 0, 0, 0) ZEND_END_ARG_INFO() @@ -24,7 +24,7 @@ static zend_class_entry *register_class_MongoDB_Driver_Monitoring_TopologyClosed INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver\\Monitoring", "TopologyClosedEvent", class_MongoDB_Driver_Monitoring_TopologyClosedEvent_methods); class_entry = zend_register_internal_class_ex(&ce, NULL); - class_entry->ce_flags |= ZEND_ACC_FINAL; + class_entry->ce_flags |= ZEND_ACC_FINAL|ZEND_ACC_NOT_SERIALIZABLE; return class_entry; } diff --git a/src/MongoDB/Monitoring/TopologyOpeningEvent.c b/src/MongoDB/Monitoring/TopologyOpeningEvent.c index e4d552c37..4fd3d4f36 100644 --- a/src/MongoDB/Monitoring/TopologyOpeningEvent.c +++ b/src/MongoDB/Monitoring/TopologyOpeningEvent.c @@ -59,12 +59,12 @@ static zend_object* php_phongo_topologyopeningevent_create_object(zend_class_ent return &intern->std; } -static HashTable* php_phongo_topologyopeningevent_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) +static HashTable* php_phongo_topologyopeningevent_get_debug_info(zend_object* object, int* is_temp) { php_phongo_topologyopeningevent_t* intern; zval retval = ZVAL_STATIC_INIT; - intern = Z_OBJ_TOPOLOGYOPENINGEVENT(PHONGO_COMPAT_GET_OBJ(object)); + intern = Z_OBJ_TOPOLOGYOPENINGEVENT(object); *is_temp = 1; array_init_size(&retval, 1); @@ -87,7 +87,6 @@ void php_phongo_topologyopeningevent_init_ce(INIT_FUNC_ARGS) { php_phongo_topologyopeningevent_ce = register_class_MongoDB_Driver_Monitoring_TopologyOpeningEvent(); php_phongo_topologyopeningevent_ce->create_object = php_phongo_topologyopeningevent_create_object; - PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_topologyopeningevent_ce); memcpy(&php_phongo_handler_topologyopeningevent, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); php_phongo_handler_topologyopeningevent.get_debug_info = php_phongo_topologyopeningevent_get_debug_info; diff --git a/src/MongoDB/Monitoring/TopologyOpeningEvent.stub.php b/src/MongoDB/Monitoring/TopologyOpeningEvent.stub.php index 87c6c1155..0632f5582 100644 --- a/src/MongoDB/Monitoring/TopologyOpeningEvent.stub.php +++ b/src/MongoDB/Monitoring/TopologyOpeningEvent.stub.php @@ -7,6 +7,7 @@ namespace MongoDB\Driver\Monitoring; +/** @not-serializable */ final class TopologyOpeningEvent { final private function __construct() {} diff --git a/src/MongoDB/Monitoring/TopologyOpeningEvent_arginfo.h b/src/MongoDB/Monitoring/TopologyOpeningEvent_arginfo.h index 222d6ee95..0b8bfd3f9 100644 --- a/src/MongoDB/Monitoring/TopologyOpeningEvent_arginfo.h +++ b/src/MongoDB/Monitoring/TopologyOpeningEvent_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 259972cabb14fbc580187f2d6ffe729c3c7f55de */ + * Stub hash: 6ab1a9ad8b25b5d09ce12c1b0fa0e69885432d6f */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_Monitoring_TopologyOpeningEvent___construct, 0, 0, 0) ZEND_END_ARG_INFO() @@ -24,7 +24,7 @@ static zend_class_entry *register_class_MongoDB_Driver_Monitoring_TopologyOpenin INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver\\Monitoring", "TopologyOpeningEvent", class_MongoDB_Driver_Monitoring_TopologyOpeningEvent_methods); class_entry = zend_register_internal_class_ex(&ce, NULL); - class_entry->ce_flags |= ZEND_ACC_FINAL; + class_entry->ce_flags |= ZEND_ACC_FINAL|ZEND_ACC_NOT_SERIALIZABLE; return class_entry; } diff --git a/src/MongoDB/Query.c b/src/MongoDB/Query.c index b92b1938f..b694ae24e 100644 --- a/src/MongoDB/Query.c +++ b/src/MongoDB/Query.c @@ -454,13 +454,13 @@ static zend_object* php_phongo_query_create_object(zend_class_entry* class_type) return &intern->std; } -static HashTable* php_phongo_query_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) +static HashTable* php_phongo_query_get_debug_info(zend_object* object, int* is_temp) { php_phongo_query_t* intern; zval retval = ZVAL_STATIC_INIT; *is_temp = 1; - intern = Z_OBJ_QUERY(PHONGO_COMPAT_GET_OBJ(object)); + intern = Z_OBJ_QUERY(object); array_init_size(&retval, 3); @@ -509,7 +509,6 @@ void php_phongo_query_init_ce(INIT_FUNC_ARGS) { php_phongo_query_ce = register_class_MongoDB_Driver_Query(); php_phongo_query_ce->create_object = php_phongo_query_create_object; - PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_query_ce); memcpy(&php_phongo_handler_query, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); php_phongo_handler_query.get_debug_info = php_phongo_query_get_debug_info; diff --git a/src/MongoDB/Query.stub.php b/src/MongoDB/Query.stub.php index 8d4d4389d..39d97d212 100644 --- a/src/MongoDB/Query.stub.php +++ b/src/MongoDB/Query.stub.php @@ -7,12 +7,8 @@ namespace MongoDB\Driver; +/** @not-serializable */ final class Query { -#if PHP_VERSION_ID >= 80000 final public function __construct(array|object $filter, ?array $queryOptions = null) {} -#else - /** @param array|object $filter */ - final public function __construct($filter, ?array $queryOptions = null) {} -#endif } diff --git a/src/MongoDB/Query_arginfo.h b/src/MongoDB/Query_arginfo.h index 079df68b5..7cb8322f9 100644 --- a/src/MongoDB/Query_arginfo.h +++ b/src/MongoDB/Query_arginfo.h @@ -1,36 +1,17 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 76ba8473a69d995471b4f645fdcc040b13febbad */ + * Stub hash: 819affbb75a46cb68d88b46e0c7137590408b010 */ -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_Query___construct, 0, 0, 1) ZEND_ARG_TYPE_MASK(0, filter, MAY_BE_ARRAY|MAY_BE_OBJECT, NULL) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, queryOptions, IS_ARRAY, 1, "null") ZEND_END_ARG_INFO() -#endif -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_Query___construct, 0, 0, 1) - ZEND_ARG_INFO(0, filter) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, queryOptions, IS_ARRAY, 1, "null") -ZEND_END_ARG_INFO() -#endif - -#if PHP_VERSION_ID >= 80000 -static ZEND_METHOD(MongoDB_Driver_Query, __construct); -#endif -#if !(PHP_VERSION_ID >= 80000) static ZEND_METHOD(MongoDB_Driver_Query, __construct); -#endif static const zend_function_entry class_MongoDB_Driver_Query_methods[] = { -#if PHP_VERSION_ID >= 80000 - ZEND_ME(MongoDB_Driver_Query, __construct, arginfo_class_MongoDB_Driver_Query___construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if !(PHP_VERSION_ID >= 80000) ZEND_ME(MongoDB_Driver_Query, __construct, arginfo_class_MongoDB_Driver_Query___construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif ZEND_FE_END }; @@ -40,7 +21,7 @@ static zend_class_entry *register_class_MongoDB_Driver_Query(void) INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "Query", class_MongoDB_Driver_Query_methods); class_entry = zend_register_internal_class_ex(&ce, NULL); - class_entry->ce_flags |= ZEND_ACC_FINAL; + class_entry->ce_flags |= ZEND_ACC_FINAL|ZEND_ACC_NOT_SERIALIZABLE; return class_entry; } diff --git a/src/MongoDB/ReadConcern.c b/src/MongoDB/ReadConcern.c index 4b6090229..6458bd750 100644 --- a/src/MongoDB/ReadConcern.c +++ b/src/MongoDB/ReadConcern.c @@ -124,13 +124,13 @@ static PHP_METHOD(MongoDB_Driver_ReadConcern, isDefault) RETURN_BOOL(mongoc_read_concern_is_default(intern->read_concern)); } -static HashTable* php_phongo_readconcern_get_properties_hash(phongo_compat_object_handler_type* object, bool is_temp) +static HashTable* php_phongo_readconcern_get_properties_hash(zend_object* object, bool is_temp) { php_phongo_readconcern_t* intern; HashTable* props; const char* level; - intern = Z_OBJ_READCONCERN(PHONGO_COMPAT_GET_OBJ(object)); + intern = Z_OBJ_READCONCERN(object); PHONGO_GET_PROPERTY_HASH_INIT_PROPS(is_temp, intern, props, 1); @@ -154,7 +154,7 @@ static PHP_METHOD(MongoDB_Driver_ReadConcern, bsonSerialize) { PHONGO_PARSE_PARAMETERS_NONE(); - ZVAL_ARR(return_value, php_phongo_readconcern_get_properties_hash(PHONGO_COMPAT_OBJ_P(getThis()), true)); + ZVAL_ARR(return_value, php_phongo_readconcern_get_properties_hash(Z_OBJ_P(getThis()), true)); convert_to_object(return_value); } @@ -230,7 +230,7 @@ static PHP_METHOD(MongoDB_Driver_ReadConcern, __serialize) { PHONGO_PARSE_PARAMETERS_NONE(); - RETURN_ARR(php_phongo_readconcern_get_properties_hash(PHONGO_COMPAT_OBJ_P(getThis()), true)); + RETURN_ARR(php_phongo_readconcern_get_properties_hash(Z_OBJ_P(getThis()), true)); } static PHP_METHOD(MongoDB_Driver_ReadConcern, __unserialize) @@ -275,13 +275,13 @@ static zend_object* php_phongo_readconcern_create_object(zend_class_entry* class return &intern->std; } -static HashTable* php_phongo_readconcern_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) +static HashTable* php_phongo_readconcern_get_debug_info(zend_object* object, int* is_temp) { *is_temp = 1; return php_phongo_readconcern_get_properties_hash(object, true); } -static HashTable* php_phongo_readconcern_get_properties(phongo_compat_object_handler_type* object) +static HashTable* php_phongo_readconcern_get_properties(zend_object* object) { return php_phongo_readconcern_get_properties_hash(object, false); } diff --git a/src/MongoDB/ReadConcern.stub.php b/src/MongoDB/ReadConcern.stub.php index 00535463c..7365273e4 100644 --- a/src/MongoDB/ReadConcern.stub.php +++ b/src/MongoDB/ReadConcern.stub.php @@ -51,12 +51,7 @@ final public function bsonSerialize(): \stdClass {} final public function serialize(): string {} -#if PHP_VERSION_ID >= 80000 final public function unserialize(string $data): void {} -#else - /** @param string $serialized */ - final public function unserialize($serialized): void {} -#endif final public function __unserialize(array $data): void {} diff --git a/src/MongoDB/ReadConcern_arginfo.h b/src/MongoDB/ReadConcern_arginfo.h index 8814d6bba..d55f93c37 100644 --- a/src/MongoDB/ReadConcern_arginfo.h +++ b/src/MongoDB/ReadConcern_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: da6e980fbfe2102334158e3018b827e0bb0a9ec3 */ + * Stub hash: d039252f9f7e9b8c30ba4794d488ad7c5cd493d2 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_ReadConcern___construct, 0, 0, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, level, IS_STRING, 1, "null") @@ -21,17 +21,9 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_ReadConcern_serialize, 0, 0, IS_STRING, 0) ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_ReadConcern_unserialize, 0, 1, IS_VOID, 0) ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0) ZEND_END_ARG_INFO() -#endif - -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_ReadConcern_unserialize, 0, 1, IS_VOID, 0) - ZEND_ARG_INFO(0, serialized) -ZEND_END_ARG_INFO() -#endif ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_ReadConcern___unserialize, 0, 1, IS_VOID, 0) ZEND_ARG_TYPE_INFO(0, data, IS_ARRAY, 0) @@ -47,12 +39,7 @@ static ZEND_METHOD(MongoDB_Driver_ReadConcern, isDefault); static ZEND_METHOD(MongoDB_Driver_ReadConcern, __set_state); static ZEND_METHOD(MongoDB_Driver_ReadConcern, bsonSerialize); static ZEND_METHOD(MongoDB_Driver_ReadConcern, serialize); -#if PHP_VERSION_ID >= 80000 static ZEND_METHOD(MongoDB_Driver_ReadConcern, unserialize); -#endif -#if !(PHP_VERSION_ID >= 80000) -static ZEND_METHOD(MongoDB_Driver_ReadConcern, unserialize); -#endif static ZEND_METHOD(MongoDB_Driver_ReadConcern, __unserialize); static ZEND_METHOD(MongoDB_Driver_ReadConcern, __serialize); @@ -64,12 +51,7 @@ static const zend_function_entry class_MongoDB_Driver_ReadConcern_methods[] = { ZEND_ME(MongoDB_Driver_ReadConcern, __set_state, arginfo_class_MongoDB_Driver_ReadConcern___set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_Driver_ReadConcern, bsonSerialize, arginfo_class_MongoDB_Driver_ReadConcern_bsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_Driver_ReadConcern, serialize, arginfo_class_MongoDB_Driver_ReadConcern_serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#if PHP_VERSION_ID >= 80000 - ZEND_ME(MongoDB_Driver_ReadConcern, unserialize, arginfo_class_MongoDB_Driver_ReadConcern_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if !(PHP_VERSION_ID >= 80000) ZEND_ME(MongoDB_Driver_ReadConcern, unserialize, arginfo_class_MongoDB_Driver_ReadConcern_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif ZEND_ME(MongoDB_Driver_ReadConcern, __unserialize, arginfo_class_MongoDB_Driver_ReadConcern___unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_Driver_ReadConcern, __serialize, arginfo_class_MongoDB_Driver_ReadConcern___serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_FE_END diff --git a/src/MongoDB/ReadPreference.c b/src/MongoDB/ReadPreference.c index 927439f65..c2c06b295 100644 --- a/src/MongoDB/ReadPreference.c +++ b/src/MongoDB/ReadPreference.c @@ -425,7 +425,7 @@ static PHP_METHOD(MongoDB_Driver_ReadPreference, getTagSets) } } -static HashTable* php_phongo_readpreference_get_properties_hash(phongo_compat_object_handler_type* object, bool is_temp) +static HashTable* php_phongo_readpreference_get_properties_hash(zend_object* object, bool is_temp) { php_phongo_readpreference_t* intern; HashTable* props; @@ -434,7 +434,7 @@ static HashTable* php_phongo_readpreference_get_properties_hash(phongo_compat_ob const bson_t* hedge; mongoc_read_mode_t mode; - intern = Z_OBJ_READPREFERENCE(PHONGO_COMPAT_GET_OBJ(object)); + intern = Z_OBJ_READPREFERENCE(object); PHONGO_GET_PROPERTY_HASH_INIT_PROPS(is_temp, intern, props, 4); @@ -501,7 +501,7 @@ static PHP_METHOD(MongoDB_Driver_ReadPreference, bsonSerialize) { PHONGO_PARSE_PARAMETERS_NONE(); - ZVAL_ARR(return_value, php_phongo_readpreference_get_properties_hash(PHONGO_COMPAT_OBJ_P(getThis()), true)); + ZVAL_ARR(return_value, php_phongo_readpreference_get_properties_hash(Z_OBJ_P(getThis()), true)); convert_to_object(return_value); } @@ -614,7 +614,7 @@ static PHP_METHOD(MongoDB_Driver_ReadPreference, __serialize) { PHONGO_PARSE_PARAMETERS_NONE(); - RETURN_ARR(php_phongo_readpreference_get_properties_hash(PHONGO_COMPAT_OBJ_P(getThis()), true)); + RETURN_ARR(php_phongo_readpreference_get_properties_hash(Z_OBJ_P(getThis()), true)); } static PHP_METHOD(MongoDB_Driver_ReadPreference, __unserialize) @@ -659,13 +659,13 @@ static zend_object* php_phongo_readpreference_create_object(zend_class_entry* cl return &intern->std; } -static HashTable* php_phongo_readpreference_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) +static HashTable* php_phongo_readpreference_get_debug_info(zend_object* object, int* is_temp) { *is_temp = 1; return php_phongo_readpreference_get_properties_hash(object, true); } -static HashTable* php_phongo_readpreference_get_properties(phongo_compat_object_handler_type* object) +static HashTable* php_phongo_readpreference_get_properties(zend_object* object) { return php_phongo_readpreference_get_properties_hash(object, false); } diff --git a/src/MongoDB/ReadPreference.stub.php b/src/MongoDB/ReadPreference.stub.php index afefec9ca..20a26c283 100644 --- a/src/MongoDB/ReadPreference.stub.php +++ b/src/MongoDB/ReadPreference.stub.php @@ -86,12 +86,7 @@ final class ReadPreference implements \MongoDB\BSON\Serializable, \Serializable */ public const SMALLEST_MAX_STALENESS_SECONDS = UNKNOWN; -#if PHP_VERSION_ID >= 80000 final public function __construct(string|int $mode, ?array $tagSets = null, ?array $options = null) {} -#else - /** @param string|int $mode */ - final public function __construct($mode, ?array $tagSets = null, ?array $options = null) {} -#endif final public function getHedge(): ?object {} @@ -110,12 +105,7 @@ final public function bsonSerialize(): \stdClass {} final public function serialize(): string {} -#if PHP_VERSION_ID >= 80000 final public function unserialize(string $data): void {} -#else - /** @param string $serialized */ - final public function unserialize($serialized): void {} -#endif final public function __unserialize(array $data): void {} diff --git a/src/MongoDB/ReadPreference_arginfo.h b/src/MongoDB/ReadPreference_arginfo.h index 9e86c33b6..903a4ea58 100644 --- a/src/MongoDB/ReadPreference_arginfo.h +++ b/src/MongoDB/ReadPreference_arginfo.h @@ -1,21 +1,11 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 5409119e964d14e52195c47daf14075fffb08926 */ + * Stub hash: 749f4ec07a374c2d9abb2dcb4cb1e7204d52923d */ -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_ReadPreference___construct, 0, 0, 1) ZEND_ARG_TYPE_MASK(0, mode, MAY_BE_STRING|MAY_BE_LONG, NULL) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, tagSets, IS_ARRAY, 1, "null") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_ARRAY, 1, "null") ZEND_END_ARG_INFO() -#endif - -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_ReadPreference___construct, 0, 0, 1) - ZEND_ARG_INFO(0, mode) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, tagSets, IS_ARRAY, 1, "null") - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_ARRAY, 1, "null") -ZEND_END_ARG_INFO() -#endif ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_ReadPreference_getHedge, 0, 0, IS_OBJECT, 1) ZEND_END_ARG_INFO() @@ -40,17 +30,9 @@ ZEND_END_ARG_INFO() #define arginfo_class_MongoDB_Driver_ReadPreference_serialize arginfo_class_MongoDB_Driver_ReadPreference_getModeString -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_ReadPreference_unserialize, 0, 1, IS_VOID, 0) ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0) ZEND_END_ARG_INFO() -#endif - -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_ReadPreference_unserialize, 0, 1, IS_VOID, 0) - ZEND_ARG_INFO(0, serialized) -ZEND_END_ARG_INFO() -#endif ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_ReadPreference___unserialize, 0, 1, IS_VOID, 0) ZEND_ARG_TYPE_INFO(0, data, IS_ARRAY, 0) @@ -59,12 +41,7 @@ ZEND_END_ARG_INFO() #define arginfo_class_MongoDB_Driver_ReadPreference___serialize arginfo_class_MongoDB_Driver_ReadPreference_getTagSets -#if PHP_VERSION_ID >= 80000 -static ZEND_METHOD(MongoDB_Driver_ReadPreference, __construct); -#endif -#if !(PHP_VERSION_ID >= 80000) static ZEND_METHOD(MongoDB_Driver_ReadPreference, __construct); -#endif static ZEND_METHOD(MongoDB_Driver_ReadPreference, getHedge); static ZEND_METHOD(MongoDB_Driver_ReadPreference, getMaxStalenessSeconds); static ZEND_METHOD(MongoDB_Driver_ReadPreference, getMode); @@ -73,23 +50,13 @@ static ZEND_METHOD(MongoDB_Driver_ReadPreference, getTagSets); static ZEND_METHOD(MongoDB_Driver_ReadPreference, __set_state); static ZEND_METHOD(MongoDB_Driver_ReadPreference, bsonSerialize); static ZEND_METHOD(MongoDB_Driver_ReadPreference, serialize); -#if PHP_VERSION_ID >= 80000 static ZEND_METHOD(MongoDB_Driver_ReadPreference, unserialize); -#endif -#if !(PHP_VERSION_ID >= 80000) -static ZEND_METHOD(MongoDB_Driver_ReadPreference, unserialize); -#endif static ZEND_METHOD(MongoDB_Driver_ReadPreference, __unserialize); static ZEND_METHOD(MongoDB_Driver_ReadPreference, __serialize); static const zend_function_entry class_MongoDB_Driver_ReadPreference_methods[] = { -#if PHP_VERSION_ID >= 80000 - ZEND_ME(MongoDB_Driver_ReadPreference, __construct, arginfo_class_MongoDB_Driver_ReadPreference___construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if !(PHP_VERSION_ID >= 80000) ZEND_ME(MongoDB_Driver_ReadPreference, __construct, arginfo_class_MongoDB_Driver_ReadPreference___construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif ZEND_ME(MongoDB_Driver_ReadPreference, getHedge, arginfo_class_MongoDB_Driver_ReadPreference_getHedge, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_Driver_ReadPreference, getMaxStalenessSeconds, arginfo_class_MongoDB_Driver_ReadPreference_getMaxStalenessSeconds, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_Driver_ReadPreference, getMode, arginfo_class_MongoDB_Driver_ReadPreference_getMode, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL|ZEND_ACC_DEPRECATED) @@ -98,12 +65,7 @@ static const zend_function_entry class_MongoDB_Driver_ReadPreference_methods[] = ZEND_ME(MongoDB_Driver_ReadPreference, __set_state, arginfo_class_MongoDB_Driver_ReadPreference___set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_Driver_ReadPreference, bsonSerialize, arginfo_class_MongoDB_Driver_ReadPreference_bsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_Driver_ReadPreference, serialize, arginfo_class_MongoDB_Driver_ReadPreference_serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#if PHP_VERSION_ID >= 80000 - ZEND_ME(MongoDB_Driver_ReadPreference, unserialize, arginfo_class_MongoDB_Driver_ReadPreference_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if !(PHP_VERSION_ID >= 80000) ZEND_ME(MongoDB_Driver_ReadPreference, unserialize, arginfo_class_MongoDB_Driver_ReadPreference_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif ZEND_ME(MongoDB_Driver_ReadPreference, __unserialize, arginfo_class_MongoDB_Driver_ReadPreference___unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_Driver_ReadPreference, __serialize, arginfo_class_MongoDB_Driver_ReadPreference___serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_FE_END diff --git a/src/MongoDB/Server.c b/src/MongoDB/Server.c index 33ca3fff8..e500c7b16 100644 --- a/src/MongoDB/Server.c +++ b/src/MongoDB/Server.c @@ -568,7 +568,7 @@ static zend_object* php_phongo_server_create_object(zend_class_entry* class_type return &intern->std; } -static HashTable* php_phongo_server_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) +static HashTable* php_phongo_server_get_debug_info(zend_object* object, int* is_temp) { php_phongo_server_t* intern = NULL; zval retval = ZVAL_STATIC_INIT; @@ -576,7 +576,7 @@ static HashTable* php_phongo_server_get_debug_info(phongo_compat_object_handler_ mongoc_server_description_t* sd; *is_temp = 1; - intern = Z_OBJ_SERVER(PHONGO_COMPAT_GET_OBJ(object)); + intern = Z_OBJ_SERVER(object); client = Z_MANAGER_OBJ_P(&intern->manager)->client; if (!(sd = mongoc_client_get_server_description(client, intern->server_id))) { @@ -594,10 +594,9 @@ void php_phongo_server_init_ce(INIT_FUNC_ARGS) { php_phongo_server_ce = register_class_MongoDB_Driver_Server(); php_phongo_server_ce->create_object = php_phongo_server_create_object; - PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_server_ce); memcpy(&php_phongo_handler_server, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); - PHONGO_COMPAT_SET_COMPARE_OBJECTS_HANDLER(server); + php_phongo_handler_server.compare = php_phongo_server_compare_objects; php_phongo_handler_server.get_debug_info = php_phongo_server_get_debug_info; php_phongo_handler_server.free_obj = php_phongo_server_free_object; php_phongo_handler_server.offset = XtOffsetOf(php_phongo_server_t, std); diff --git a/src/MongoDB/Server.stub.php b/src/MongoDB/Server.stub.php index 0db68169c..549fe4ef8 100644 --- a/src/MongoDB/Server.stub.php +++ b/src/MongoDB/Server.stub.php @@ -7,6 +7,7 @@ namespace MongoDB\Driver; +/** @not-serializable */ final class Server { /** @@ -71,26 +72,11 @@ final class Server final private function __construct() {} -#if PHP_VERSION_ID >= 80000 final public function executeBulkWrite(string $namespace, BulkWrite $bulkWrite, array|WriteConcern|null $options = null): WriteResult {} -#else - /** @param array|WriteConcern|null $options */ - final public function executeBulkWrite(string $namespace, BulkWrite $bulkWrite, $options = null): WriteResult {} -#endif -#if PHP_VERSION_ID >= 80000 final public function executeCommand(string $db, Command $command, array|ReadPreference|null $options = null): Cursor {} -#else - /** @param array|ReadPreference|null $options */ - final public function executeCommand(string $db, Command $command, $options = null): Cursor {} -#endif -#if PHP_VERSION_ID >= 80000 final public function executeQuery(string $namespace, Query $query, array|ReadPreference|null $options = null): Cursor {} -#else - /** @param array|ReadPreference|null $options */ - final public function executeQuery(string $namespace, Query $query, $options = null): Cursor {} -#endif final public function executeReadCommand(string $db, Command $command, ?array $options = null): Cursor {} diff --git a/src/MongoDB/ServerApi.c b/src/MongoDB/ServerApi.c index eec5b9c50..2a74db0b7 100644 --- a/src/MongoDB/ServerApi.c +++ b/src/MongoDB/ServerApi.c @@ -139,14 +139,14 @@ static PHP_METHOD(MongoDB_Driver_ServerApi, __set_state) php_phongo_serverapi_init_from_hash(intern, props); } -static HashTable* php_phongo_serverapi_get_properties_hash(phongo_compat_object_handler_type* object, bool is_temp, bool include_null) +static HashTable* php_phongo_serverapi_get_properties_hash(zend_object* object, bool is_temp, bool include_null) { php_phongo_serverapi_t* intern; HashTable* props; zval version, strict, deprecation_errors; bool is_set; - intern = Z_OBJ_SERVERAPI(PHONGO_COMPAT_GET_OBJ(object)); + intern = Z_OBJ_SERVERAPI(object); PHONGO_GET_PROPERTY_HASH_INIT_PROPS(is_temp, intern, props, 1); @@ -182,7 +182,7 @@ static PHP_METHOD(MongoDB_Driver_ServerApi, bsonSerialize) { PHONGO_PARSE_PARAMETERS_NONE(); - ZVAL_ARR(return_value, php_phongo_serverapi_get_properties_hash(PHONGO_COMPAT_OBJ_P(getThis()), true, false)); + ZVAL_ARR(return_value, php_phongo_serverapi_get_properties_hash(Z_OBJ_P(getThis()), true, false)); convert_to_object(return_value); } @@ -260,7 +260,7 @@ static PHP_METHOD(MongoDB_Driver_ServerApi, __serialize) { PHONGO_PARSE_PARAMETERS_NONE(); - RETURN_ARR(php_phongo_serverapi_get_properties_hash(PHONGO_COMPAT_OBJ_P(getThis()), true, true)); + RETURN_ARR(php_phongo_serverapi_get_properties_hash(Z_OBJ_P(getThis()), true, true)); } static PHP_METHOD(MongoDB_Driver_ServerApi, __unserialize) @@ -305,13 +305,13 @@ static zend_object* php_phongo_serverapi_create_object(zend_class_entry* class_t return &intern->std; } -static HashTable* php_phongo_serverapi_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) +static HashTable* php_phongo_serverapi_get_debug_info(zend_object* object, int* is_temp) { *is_temp = 1; return php_phongo_serverapi_get_properties_hash(object, true, true); } -static HashTable* php_phongo_serverapi_get_properties(phongo_compat_object_handler_type* object) +static HashTable* php_phongo_serverapi_get_properties(zend_object* object) { return php_phongo_serverapi_get_properties_hash(object, false, true); } diff --git a/src/MongoDB/ServerApi.stub.php b/src/MongoDB/ServerApi.stub.php index fd907d5ca..21db917ad 100644 --- a/src/MongoDB/ServerApi.stub.php +++ b/src/MongoDB/ServerApi.stub.php @@ -20,12 +20,7 @@ final public function bsonSerialize(): \stdClass {} final public function serialize(): string {} -#if PHP_VERSION_ID >= 80000 final public function unserialize(string $data): void {} -#else - /** @param string $serialized */ - final public function unserialize($serialized): void {} -#endif final public function __unserialize(array $data): void {} diff --git a/src/MongoDB/ServerApi_arginfo.h b/src/MongoDB/ServerApi_arginfo.h index f3da02d42..7c39cac5b 100644 --- a/src/MongoDB/ServerApi_arginfo.h +++ b/src/MongoDB/ServerApi_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 7678bfacdb398a3528feb4226a5ca1b8a21b9516 */ + * Stub hash: 44bcb97e14839e750c86309b7b9d2d861db89910 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_ServerApi___construct, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, version, IS_STRING, 0) @@ -17,17 +17,9 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_ServerApi_serialize, 0, 0, IS_STRING, 0) ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_ServerApi_unserialize, 0, 1, IS_VOID, 0) ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0) ZEND_END_ARG_INFO() -#endif - -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_ServerApi_unserialize, 0, 1, IS_VOID, 0) - ZEND_ARG_INFO(0, serialized) -ZEND_END_ARG_INFO() -#endif ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_ServerApi___unserialize, 0, 1, IS_VOID, 0) ZEND_ARG_TYPE_INFO(0, data, IS_ARRAY, 0) @@ -41,12 +33,7 @@ static ZEND_METHOD(MongoDB_Driver_ServerApi, __construct); static ZEND_METHOD(MongoDB_Driver_ServerApi, __set_state); static ZEND_METHOD(MongoDB_Driver_ServerApi, bsonSerialize); static ZEND_METHOD(MongoDB_Driver_ServerApi, serialize); -#if PHP_VERSION_ID >= 80000 static ZEND_METHOD(MongoDB_Driver_ServerApi, unserialize); -#endif -#if !(PHP_VERSION_ID >= 80000) -static ZEND_METHOD(MongoDB_Driver_ServerApi, unserialize); -#endif static ZEND_METHOD(MongoDB_Driver_ServerApi, __unserialize); static ZEND_METHOD(MongoDB_Driver_ServerApi, __serialize); @@ -56,12 +43,7 @@ static const zend_function_entry class_MongoDB_Driver_ServerApi_methods[] = { ZEND_ME(MongoDB_Driver_ServerApi, __set_state, arginfo_class_MongoDB_Driver_ServerApi___set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_Driver_ServerApi, bsonSerialize, arginfo_class_MongoDB_Driver_ServerApi_bsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_Driver_ServerApi, serialize, arginfo_class_MongoDB_Driver_ServerApi_serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#if PHP_VERSION_ID >= 80000 - ZEND_ME(MongoDB_Driver_ServerApi, unserialize, arginfo_class_MongoDB_Driver_ServerApi_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if !(PHP_VERSION_ID >= 80000) ZEND_ME(MongoDB_Driver_ServerApi, unserialize, arginfo_class_MongoDB_Driver_ServerApi_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif ZEND_ME(MongoDB_Driver_ServerApi, __unserialize, arginfo_class_MongoDB_Driver_ServerApi___unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_Driver_ServerApi, __serialize, arginfo_class_MongoDB_Driver_ServerApi___serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_FE_END diff --git a/src/MongoDB/ServerDescription.c b/src/MongoDB/ServerDescription.c index 3b998c532..1a0516acf 100644 --- a/src/MongoDB/ServerDescription.c +++ b/src/MongoDB/ServerDescription.c @@ -180,12 +180,12 @@ static zend_object* php_phongo_serverdescription_create_object(zend_class_entry* return &intern->std; } -HashTable* php_phongo_serverdescription_get_properties_hash(phongo_compat_object_handler_type* object, bool is_debug) +HashTable* php_phongo_serverdescription_get_properties_hash(zend_object* object, bool is_debug) { php_phongo_serverdescription_t* intern = NULL; HashTable* props; - intern = Z_OBJ_SERVERDESCRIPTION(PHONGO_COMPAT_GET_OBJ(object)); + intern = Z_OBJ_SERVERDESCRIPTION(object); PHONGO_GET_PROPERTY_HASH_INIT_PROPS(is_debug, intern, props, 6); @@ -256,13 +256,13 @@ HashTable* php_phongo_serverdescription_get_properties_hash(phongo_compat_object return props; } -static HashTable* php_phongo_serverdescription_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) +static HashTable* php_phongo_serverdescription_get_debug_info(zend_object* object, int* is_temp) { *is_temp = 1; return php_phongo_serverdescription_get_properties_hash(object, true); } -static HashTable* php_phongo_serverdescription_get_properties(phongo_compat_object_handler_type* object) +static HashTable* php_phongo_serverdescription_get_properties(zend_object* object) { return php_phongo_serverdescription_get_properties_hash(object, false); } @@ -271,7 +271,6 @@ void php_phongo_serverdescription_init_ce(INIT_FUNC_ARGS) { php_phongo_serverdescription_ce = register_class_MongoDB_Driver_ServerDescription(); php_phongo_serverdescription_ce->create_object = php_phongo_serverdescription_create_object; - PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_serverdescription_ce); memcpy(&php_phongo_handler_serverdescription, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); php_phongo_handler_serverdescription.get_debug_info = php_phongo_serverdescription_get_debug_info; diff --git a/src/MongoDB/ServerDescription.stub.php b/src/MongoDB/ServerDescription.stub.php index 57a8f42ec..c8a9e3d8c 100644 --- a/src/MongoDB/ServerDescription.stub.php +++ b/src/MongoDB/ServerDescription.stub.php @@ -7,6 +7,7 @@ namespace MongoDB\Driver; +/** @not-serializable */ final class ServerDescription { /** diff --git a/src/MongoDB/ServerDescription_arginfo.h b/src/MongoDB/ServerDescription_arginfo.h index fe10e7dd1..d5731f9bb 100644 --- a/src/MongoDB/ServerDescription_arginfo.h +++ b/src/MongoDB/ServerDescription_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 85cce1e6824dec5cb0d659b841d893a849948eeb */ + * Stub hash: 482425509937fc9119cf140099b41af3c4a20fde */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_ServerDescription___construct, 0, 0, 0) ZEND_END_ARG_INFO() @@ -47,7 +47,7 @@ static zend_class_entry *register_class_MongoDB_Driver_ServerDescription(void) INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "ServerDescription", class_MongoDB_Driver_ServerDescription_methods); class_entry = zend_register_internal_class_ex(&ce, NULL); - class_entry->ce_flags |= ZEND_ACC_FINAL; + class_entry->ce_flags |= ZEND_ACC_FINAL|ZEND_ACC_NOT_SERIALIZABLE; zval const_TYPE_UNKNOWN_value; zend_string *const_TYPE_UNKNOWN_value_str = zend_string_init(PHONGO_SERVER_TYPE_UNKNOWN, strlen(PHONGO_SERVER_TYPE_UNKNOWN), 1); diff --git a/src/MongoDB/Server_arginfo.h b/src/MongoDB/Server_arginfo.h index 7a2f0b612..701186aad 100644 --- a/src/MongoDB/Server_arginfo.h +++ b/src/MongoDB/Server_arginfo.h @@ -1,56 +1,26 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 9b0019f2cbd014ae1e31f5803e0dc5b6c9cf701a */ + * Stub hash: 5edd7242100364c5e4beddc89b4d92dda70c09f6 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_Server___construct, 0, 0, 0) ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Server_executeBulkWrite, 0, 2, MongoDB\\Driver\\WriteResult, 0) ZEND_ARG_TYPE_INFO(0, namespace, IS_STRING, 0) ZEND_ARG_OBJ_INFO(0, bulkWrite, MongoDB\\Driver\\BulkWrite, 0) ZEND_ARG_OBJ_TYPE_MASK(0, options, MongoDB\\Driver\\WriteConcern, MAY_BE_ARRAY|MAY_BE_NULL, "null") ZEND_END_ARG_INFO() -#endif -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Server_executeBulkWrite, 0, 2, MongoDB\\Driver\\WriteResult, 0) - ZEND_ARG_TYPE_INFO(0, namespace, IS_STRING, 0) - ZEND_ARG_OBJ_INFO(0, bulkWrite, MongoDB\\Driver\\BulkWrite, 0) - ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, options, "null") -ZEND_END_ARG_INFO() -#endif - -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Server_executeCommand, 0, 2, MongoDB\\Driver\\Cursor, 0) ZEND_ARG_TYPE_INFO(0, db, IS_STRING, 0) ZEND_ARG_OBJ_INFO(0, command, MongoDB\\Driver\\Command, 0) ZEND_ARG_OBJ_TYPE_MASK(0, options, MongoDB\\Driver\\ReadPreference, MAY_BE_ARRAY|MAY_BE_NULL, "null") ZEND_END_ARG_INFO() -#endif -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Server_executeCommand, 0, 2, MongoDB\\Driver\\Cursor, 0) - ZEND_ARG_TYPE_INFO(0, db, IS_STRING, 0) - ZEND_ARG_OBJ_INFO(0, command, MongoDB\\Driver\\Command, 0) - ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, options, "null") -ZEND_END_ARG_INFO() -#endif - -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Server_executeQuery, 0, 2, MongoDB\\Driver\\Cursor, 0) ZEND_ARG_TYPE_INFO(0, namespace, IS_STRING, 0) ZEND_ARG_OBJ_INFO(0, query, MongoDB\\Driver\\Query, 0) ZEND_ARG_OBJ_TYPE_MASK(0, options, MongoDB\\Driver\\ReadPreference, MAY_BE_ARRAY|MAY_BE_NULL, "null") ZEND_END_ARG_INFO() -#endif - -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Server_executeQuery, 0, 2, MongoDB\\Driver\\Cursor, 0) - ZEND_ARG_TYPE_INFO(0, namespace, IS_STRING, 0) - ZEND_ARG_OBJ_INFO(0, query, MongoDB\\Driver\\Query, 0) - ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, options, "null") -ZEND_END_ARG_INFO() -#endif ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Server_executeReadCommand, 0, 2, MongoDB\\Driver\\Cursor, 0) ZEND_ARG_TYPE_INFO(0, db, IS_STRING, 0) @@ -94,24 +64,9 @@ ZEND_END_ARG_INFO() static ZEND_METHOD(MongoDB_Driver_Server, __construct); -#if PHP_VERSION_ID >= 80000 -static ZEND_METHOD(MongoDB_Driver_Server, executeBulkWrite); -#endif -#if !(PHP_VERSION_ID >= 80000) static ZEND_METHOD(MongoDB_Driver_Server, executeBulkWrite); -#endif -#if PHP_VERSION_ID >= 80000 static ZEND_METHOD(MongoDB_Driver_Server, executeCommand); -#endif -#if !(PHP_VERSION_ID >= 80000) -static ZEND_METHOD(MongoDB_Driver_Server, executeCommand); -#endif -#if PHP_VERSION_ID >= 80000 -static ZEND_METHOD(MongoDB_Driver_Server, executeQuery); -#endif -#if !(PHP_VERSION_ID >= 80000) static ZEND_METHOD(MongoDB_Driver_Server, executeQuery); -#endif static ZEND_METHOD(MongoDB_Driver_Server, executeReadCommand); static ZEND_METHOD(MongoDB_Driver_Server, executeReadWriteCommand); static ZEND_METHOD(MongoDB_Driver_Server, executeWriteCommand); @@ -131,24 +86,9 @@ static ZEND_METHOD(MongoDB_Driver_Server, isSecondary); static const zend_function_entry class_MongoDB_Driver_Server_methods[] = { ZEND_ME(MongoDB_Driver_Server, __construct, arginfo_class_MongoDB_Driver_Server___construct, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL) -#if PHP_VERSION_ID >= 80000 - ZEND_ME(MongoDB_Driver_Server, executeBulkWrite, arginfo_class_MongoDB_Driver_Server_executeBulkWrite, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if !(PHP_VERSION_ID >= 80000) ZEND_ME(MongoDB_Driver_Server, executeBulkWrite, arginfo_class_MongoDB_Driver_Server_executeBulkWrite, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if PHP_VERSION_ID >= 80000 ZEND_ME(MongoDB_Driver_Server, executeCommand, arginfo_class_MongoDB_Driver_Server_executeCommand, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if !(PHP_VERSION_ID >= 80000) - ZEND_ME(MongoDB_Driver_Server, executeCommand, arginfo_class_MongoDB_Driver_Server_executeCommand, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if PHP_VERSION_ID >= 80000 - ZEND_ME(MongoDB_Driver_Server, executeQuery, arginfo_class_MongoDB_Driver_Server_executeQuery, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if !(PHP_VERSION_ID >= 80000) ZEND_ME(MongoDB_Driver_Server, executeQuery, arginfo_class_MongoDB_Driver_Server_executeQuery, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif ZEND_ME(MongoDB_Driver_Server, executeReadCommand, arginfo_class_MongoDB_Driver_Server_executeReadCommand, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_Driver_Server, executeReadWriteCommand, arginfo_class_MongoDB_Driver_Server_executeReadWriteCommand, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_Driver_Server, executeWriteCommand, arginfo_class_MongoDB_Driver_Server_executeWriteCommand, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) @@ -173,7 +113,7 @@ static zend_class_entry *register_class_MongoDB_Driver_Server(void) INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "Server", class_MongoDB_Driver_Server_methods); class_entry = zend_register_internal_class_ex(&ce, NULL); - class_entry->ce_flags |= ZEND_ACC_FINAL; + class_entry->ce_flags |= ZEND_ACC_FINAL|ZEND_ACC_NOT_SERIALIZABLE; zval const_TYPE_UNKNOWN_value; ZVAL_LONG(&const_TYPE_UNKNOWN_value, PHONGO_SERVER_UNKNOWN); diff --git a/src/MongoDB/Session.c b/src/MongoDB/Session.c index 18bf3d564..37dff62d5 100644 --- a/src/MongoDB/Session.c +++ b/src/MongoDB/Session.c @@ -52,13 +52,13 @@ static bool php_phongo_session_get_timestamp_parts(zval* obj, uint32_t* timestam zval ztimestamp = ZVAL_STATIC_INIT; zval zincrement = ZVAL_STATIC_INIT; - zend_call_method_with_0_params(PHONGO_COMPAT_OBJ_P(obj), NULL, NULL, "getTimestamp", &ztimestamp); + zend_call_method_with_0_params(Z_OBJ_P(obj), NULL, NULL, "getTimestamp", &ztimestamp); if (Z_ISUNDEF(ztimestamp) || EG(exception)) { goto cleanup; } - zend_call_method_with_0_params(PHONGO_COMPAT_OBJ_P(obj), NULL, NULL, "getIncrement", &zincrement); + zend_call_method_with_0_params(Z_OBJ_P(obj), NULL, NULL, "getIncrement", &zincrement); if (Z_ISUNDEF(zincrement) || EG(exception)) { goto cleanup; @@ -580,13 +580,13 @@ static zend_object* php_phongo_session_create_object(zend_class_entry* class_typ return &intern->std; } -static HashTable* php_phongo_session_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) +static HashTable* php_phongo_session_get_debug_info(zend_object* object, int* is_temp) { php_phongo_session_t* intern = NULL; zval retval = ZVAL_STATIC_INIT; *is_temp = 1; - intern = Z_OBJ_SESSION(PHONGO_COMPAT_GET_OBJ(object)); + intern = Z_OBJ_SESSION(object); array_init(&retval); @@ -696,7 +696,6 @@ void php_phongo_session_init_ce(INIT_FUNC_ARGS) { php_phongo_session_ce = register_class_MongoDB_Driver_Session(); php_phongo_session_ce->create_object = php_phongo_session_create_object; - PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_session_ce); memcpy(&php_phongo_handler_session, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); php_phongo_handler_session.get_debug_info = php_phongo_session_get_debug_info; diff --git a/src/MongoDB/Session.stub.php b/src/MongoDB/Session.stub.php index 91f35a425..9538ece56 100644 --- a/src/MongoDB/Session.stub.php +++ b/src/MongoDB/Session.stub.php @@ -7,6 +7,7 @@ namespace MongoDB\Driver; +/** @not-serializable */ final class Session { /** @@ -43,12 +44,7 @@ final private function __construct() {} final public function abortTransaction(): void {} -#if PHP_VERSION_ID >= 80000 final public function advanceClusterTime(array|object $clusterTime): void {} -#else - /** @param array|object $clusterTime */ - final public function advanceClusterTime($clusterTime): void {} -#endif final public function advanceOperationTime(\MongoDB\BSON\TimestampInterface $operationTime): void {} diff --git a/src/MongoDB/Session_arginfo.h b/src/MongoDB/Session_arginfo.h index a79f46ba5..221a3f648 100644 --- a/src/MongoDB/Session_arginfo.h +++ b/src/MongoDB/Session_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: bb079e9e8c8eb59e26ebdf981d1b0ed085c8bbe6 */ + * Stub hash: 22e0a387ed21d232c61f805ba258c4781a08a68e */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_Session___construct, 0, 0, 0) ZEND_END_ARG_INFO() @@ -7,17 +7,9 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_Session_abortTransaction, 0, 0, IS_VOID, 0) ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_Session_advanceClusterTime, 0, 1, IS_VOID, 0) ZEND_ARG_TYPE_MASK(0, clusterTime, MAY_BE_ARRAY|MAY_BE_OBJECT, NULL) ZEND_END_ARG_INFO() -#endif - -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_Session_advanceClusterTime, 0, 1, IS_VOID, 0) - ZEND_ARG_INFO(0, clusterTime) -ZEND_END_ARG_INFO() -#endif ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_Session_advanceOperationTime, 0, 1, IS_VOID, 0) ZEND_ARG_OBJ_INFO(0, operationTime, MongoDB\\BSON\\TimestampInterface, 0) @@ -57,12 +49,7 @@ ZEND_END_ARG_INFO() static ZEND_METHOD(MongoDB_Driver_Session, __construct); static ZEND_METHOD(MongoDB_Driver_Session, abortTransaction); -#if PHP_VERSION_ID >= 80000 static ZEND_METHOD(MongoDB_Driver_Session, advanceClusterTime); -#endif -#if !(PHP_VERSION_ID >= 80000) -static ZEND_METHOD(MongoDB_Driver_Session, advanceClusterTime); -#endif static ZEND_METHOD(MongoDB_Driver_Session, advanceOperationTime); static ZEND_METHOD(MongoDB_Driver_Session, commitTransaction); static ZEND_METHOD(MongoDB_Driver_Session, endSession); @@ -80,12 +67,7 @@ static ZEND_METHOD(MongoDB_Driver_Session, startTransaction); static const zend_function_entry class_MongoDB_Driver_Session_methods[] = { ZEND_ME(MongoDB_Driver_Session, __construct, arginfo_class_MongoDB_Driver_Session___construct, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL) ZEND_ME(MongoDB_Driver_Session, abortTransaction, arginfo_class_MongoDB_Driver_Session_abortTransaction, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#if PHP_VERSION_ID >= 80000 - ZEND_ME(MongoDB_Driver_Session, advanceClusterTime, arginfo_class_MongoDB_Driver_Session_advanceClusterTime, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if !(PHP_VERSION_ID >= 80000) ZEND_ME(MongoDB_Driver_Session, advanceClusterTime, arginfo_class_MongoDB_Driver_Session_advanceClusterTime, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif ZEND_ME(MongoDB_Driver_Session, advanceOperationTime, arginfo_class_MongoDB_Driver_Session_advanceOperationTime, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_Driver_Session, commitTransaction, arginfo_class_MongoDB_Driver_Session_commitTransaction, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_Driver_Session, endSession, arginfo_class_MongoDB_Driver_Session_endSession, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) @@ -107,7 +89,7 @@ static zend_class_entry *register_class_MongoDB_Driver_Session(void) INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "Session", class_MongoDB_Driver_Session_methods); class_entry = zend_register_internal_class_ex(&ce, NULL); - class_entry->ce_flags |= ZEND_ACC_FINAL; + class_entry->ce_flags |= ZEND_ACC_FINAL|ZEND_ACC_NOT_SERIALIZABLE; zval const_TRANSACTION_NONE_value; zend_string *const_TRANSACTION_NONE_value_str = zend_string_init(PHONGO_TRANSACTION_NONE, strlen(PHONGO_TRANSACTION_NONE), 1); diff --git a/src/MongoDB/TopologyDescription.c b/src/MongoDB/TopologyDescription.c index 0cd1ff5f0..ab625dff0 100644 --- a/src/MongoDB/TopologyDescription.c +++ b/src/MongoDB/TopologyDescription.c @@ -129,12 +129,12 @@ static zend_object* php_phongo_topologydescription_create_object(zend_class_entr return &intern->std; } -HashTable* php_phongo_topologydescription_get_properties_hash(phongo_compat_object_handler_type* object, bool is_debug) +HashTable* php_phongo_topologydescription_get_properties_hash(zend_object* object, bool is_debug) { php_phongo_topologydescription_t* intern = NULL; HashTable* props; - intern = Z_OBJ_TOPOLOGYDESCRIPTION(PHONGO_COMPAT_GET_OBJ(object)); + intern = Z_OBJ_TOPOLOGYDESCRIPTION(object); PHONGO_GET_PROPERTY_HASH_INIT_PROPS(is_debug, intern, props, 2); @@ -169,13 +169,13 @@ HashTable* php_phongo_topologydescription_get_properties_hash(phongo_compat_obje return props; } -static HashTable* php_phongo_topologydescription_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) +static HashTable* php_phongo_topologydescription_get_debug_info(zend_object* object, int* is_temp) { *is_temp = 1; return php_phongo_topologydescription_get_properties_hash(object, true); } -static HashTable* php_phongo_topologydescription_get_properties(phongo_compat_object_handler_type* object) +static HashTable* php_phongo_topologydescription_get_properties(zend_object* object) { return php_phongo_topologydescription_get_properties_hash(object, false); } @@ -184,7 +184,6 @@ void php_phongo_topologydescription_init_ce(INIT_FUNC_ARGS) { php_phongo_topologydescription_ce = register_class_MongoDB_Driver_TopologyDescription(); php_phongo_topologydescription_ce->create_object = php_phongo_topologydescription_create_object; - PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_topologydescription_ce); memcpy(&php_phongo_handler_topologydescription, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); php_phongo_handler_topologydescription.get_debug_info = php_phongo_topologydescription_get_debug_info; diff --git a/src/MongoDB/TopologyDescription.stub.php b/src/MongoDB/TopologyDescription.stub.php index 46c8d045c..e3962f0e9 100644 --- a/src/MongoDB/TopologyDescription.stub.php +++ b/src/MongoDB/TopologyDescription.stub.php @@ -7,6 +7,7 @@ namespace MongoDB\Driver; +/** @not-serializable */ final class TopologyDescription { /** diff --git a/src/MongoDB/TopologyDescription_arginfo.h b/src/MongoDB/TopologyDescription_arginfo.h index 63fc84a34..23564fcef 100644 --- a/src/MongoDB/TopologyDescription_arginfo.h +++ b/src/MongoDB/TopologyDescription_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 7c61addf17e525496c8755d437b4db423f6be59d */ + * Stub hash: 2cd175f4e81e332cd83adb867d51db77907ee8c7 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_TopologyDescription___construct, 0, 0, 0) ZEND_END_ARG_INFO() @@ -40,7 +40,7 @@ static zend_class_entry *register_class_MongoDB_Driver_TopologyDescription(void) INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "TopologyDescription", class_MongoDB_Driver_TopologyDescription_methods); class_entry = zend_register_internal_class_ex(&ce, NULL); - class_entry->ce_flags |= ZEND_ACC_FINAL; + class_entry->ce_flags |= ZEND_ACC_FINAL|ZEND_ACC_NOT_SERIALIZABLE; zval const_TYPE_UNKNOWN_value; zend_string *const_TYPE_UNKNOWN_value_str = zend_string_init(PHONGO_TOPOLOGY_UNKNOWN, strlen(PHONGO_TOPOLOGY_UNKNOWN), 1); diff --git a/src/MongoDB/WriteConcern.c b/src/MongoDB/WriteConcern.c index 109072567..4a5b26d85 100644 --- a/src/MongoDB/WriteConcern.c +++ b/src/MongoDB/WriteConcern.c @@ -264,7 +264,7 @@ static PHP_METHOD(MongoDB_Driver_WriteConcern, isDefault) RETURN_BOOL(mongoc_write_concern_is_default(intern->write_concern)); } -static HashTable* php_phongo_writeconcern_get_properties_hash(phongo_compat_object_handler_type* object, bool is_temp, bool is_bson, bool is_serialize) +static HashTable* php_phongo_writeconcern_get_properties_hash(zend_object* object, bool is_temp, bool is_bson, bool is_serialize) { php_phongo_writeconcern_t* intern; HashTable* props; @@ -272,7 +272,7 @@ static HashTable* php_phongo_writeconcern_get_properties_hash(phongo_compat_obje int32_t w; int64_t wtimeout; - intern = Z_OBJ_WRITECONCERN(PHONGO_COMPAT_GET_OBJ(object)); + intern = Z_OBJ_WRITECONCERN(object); PHONGO_GET_PROPERTY_HASH_INIT_PROPS(is_temp, intern, props, 4); @@ -339,7 +339,7 @@ static PHP_METHOD(MongoDB_Driver_WriteConcern, bsonSerialize) { PHONGO_PARSE_PARAMETERS_NONE(); - ZVAL_ARR(return_value, php_phongo_writeconcern_get_properties_hash(PHONGO_COMPAT_OBJ_P(getThis()), true, true, false)); + ZVAL_ARR(return_value, php_phongo_writeconcern_get_properties_hash(Z_OBJ_P(getThis()), true, true, false)); convert_to_object(return_value); } @@ -434,7 +434,7 @@ static PHP_METHOD(MongoDB_Driver_WriteConcern, __serialize) { PHONGO_PARSE_PARAMETERS_NONE(); - RETURN_ARR(php_phongo_writeconcern_get_properties_hash(PHONGO_COMPAT_OBJ_P(getThis()), true, false, true)); + RETURN_ARR(php_phongo_writeconcern_get_properties_hash(Z_OBJ_P(getThis()), true, false, true)); } static PHP_METHOD(MongoDB_Driver_WriteConcern, __unserialize) @@ -479,13 +479,13 @@ static zend_object* php_phongo_writeconcern_create_object(zend_class_entry* clas return &intern->std; } -static HashTable* php_phongo_writeconcern_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) +static HashTable* php_phongo_writeconcern_get_debug_info(zend_object* object, int* is_temp) { *is_temp = 1; return php_phongo_writeconcern_get_properties_hash(object, true, false, false); } -static HashTable* php_phongo_writeconcern_get_properties(phongo_compat_object_handler_type* object) +static HashTable* php_phongo_writeconcern_get_properties(zend_object* object) { return php_phongo_writeconcern_get_properties_hash(object, false, false, false); } diff --git a/src/MongoDB/WriteConcern.stub.php b/src/MongoDB/WriteConcern.stub.php index d02c3aa80..f46ca6dca 100644 --- a/src/MongoDB/WriteConcern.stub.php +++ b/src/MongoDB/WriteConcern.stub.php @@ -15,21 +15,11 @@ final class WriteConcern implements \MongoDB\BSON\Serializable, \Serializable */ public const MAJORITY = UNKNOWN; -#if PHP_VERSION_ID >= 80000 final public function __construct(string|int $w, ?int $wtimeout = null, ?bool $journal = null) {} -#else - /** @param string|int $w */ - final public function __construct($w, ?int $wtimeout = null, ?bool $journal = null) {} -#endif final public function getJournal(): ?bool {} -#if PHP_VERSION_ID >= 80000 final public function getW(): string|int|null {} -#else - /** @return string|int|null */ - final public function getW() {} -#endif final public function getWtimeout(): int {} @@ -41,12 +31,7 @@ final public function bsonSerialize(): \stdClass {} final public function serialize(): string {} -#if PHP_VERSION_ID >= 80000 final public function unserialize(string $data): void {} -#else - /** @param string $serialized */ - final public function unserialize($serialized): void {} -#endif final public function __unserialize(array $data): void {} diff --git a/src/MongoDB/WriteConcernError.c b/src/MongoDB/WriteConcernError.c index 97bfedfcd..9a9acd007 100644 --- a/src/MongoDB/WriteConcernError.c +++ b/src/MongoDB/WriteConcernError.c @@ -101,13 +101,13 @@ static zend_object* php_phongo_writeconcernerror_create_object(zend_class_entry* return &intern->std; } -static HashTable* php_phongo_writeconcernerror_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) +static HashTable* php_phongo_writeconcernerror_get_debug_info(zend_object* object, int* is_temp) { php_phongo_writeconcernerror_t* intern; zval retval = ZVAL_STATIC_INIT; *is_temp = 1; - intern = Z_OBJ_WRITECONCERNERROR(PHONGO_COMPAT_GET_OBJ(object)); + intern = Z_OBJ_WRITECONCERNERROR(object); array_init_size(&retval, 3); ADD_ASSOC_STRING(&retval, "message", intern->message ? intern->message : ""); @@ -126,7 +126,6 @@ void php_phongo_writeconcernerror_init_ce(INIT_FUNC_ARGS) { php_phongo_writeconcernerror_ce = register_class_MongoDB_Driver_WriteConcernError(); php_phongo_writeconcernerror_ce->create_object = php_phongo_writeconcernerror_create_object; - PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_writeconcernerror_ce); memcpy(&php_phongo_handler_writeconcernerror, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); php_phongo_handler_writeconcernerror.get_debug_info = php_phongo_writeconcernerror_get_debug_info; diff --git a/src/MongoDB/WriteConcernError.stub.php b/src/MongoDB/WriteConcernError.stub.php index a84cb462d..b7df806f4 100644 --- a/src/MongoDB/WriteConcernError.stub.php +++ b/src/MongoDB/WriteConcernError.stub.php @@ -7,6 +7,7 @@ namespace MongoDB\Driver; +/** @not-serializable */ final class WriteConcernError { final private function __construct() {} diff --git a/src/MongoDB/WriteConcernError_arginfo.h b/src/MongoDB/WriteConcernError_arginfo.h index 9aefb05ae..8d61bae68 100644 --- a/src/MongoDB/WriteConcernError_arginfo.h +++ b/src/MongoDB/WriteConcernError_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: fe3937eef4e97a6d3097b81fc196c5c5d86e9df8 */ + * Stub hash: a405afbb8eaa3bf544759f7a6ae9330ced7e7cc0 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_WriteConcernError___construct, 0, 0, 0) ZEND_END_ARG_INFO() @@ -34,7 +34,7 @@ static zend_class_entry *register_class_MongoDB_Driver_WriteConcernError(void) INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "WriteConcernError", class_MongoDB_Driver_WriteConcernError_methods); class_entry = zend_register_internal_class_ex(&ce, NULL); - class_entry->ce_flags |= ZEND_ACC_FINAL; + class_entry->ce_flags |= ZEND_ACC_FINAL|ZEND_ACC_NOT_SERIALIZABLE; return class_entry; } diff --git a/src/MongoDB/WriteConcern_arginfo.h b/src/MongoDB/WriteConcern_arginfo.h index 3a407e1a5..22c7a3975 100644 --- a/src/MongoDB/WriteConcern_arginfo.h +++ b/src/MongoDB/WriteConcern_arginfo.h @@ -1,34 +1,17 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 690913f0505161b1b2ca35495c4cdb06c263aacb */ + * Stub hash: 5b78e4484cebcf558867cf47defea6ae25b42d76 */ -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_WriteConcern___construct, 0, 0, 1) ZEND_ARG_TYPE_MASK(0, w, MAY_BE_STRING|MAY_BE_LONG, NULL) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, wtimeout, IS_LONG, 1, "null") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, journal, _IS_BOOL, 1, "null") ZEND_END_ARG_INFO() -#endif - -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_WriteConcern___construct, 0, 0, 1) - ZEND_ARG_INFO(0, w) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, wtimeout, IS_LONG, 1, "null") - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, journal, _IS_BOOL, 1, "null") -ZEND_END_ARG_INFO() -#endif ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_WriteConcern_getJournal, 0, 0, _IS_BOOL, 1) ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_class_MongoDB_Driver_WriteConcern_getW, 0, 0, MAY_BE_STRING|MAY_BE_LONG|MAY_BE_NULL) ZEND_END_ARG_INFO() -#endif - -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_WriteConcern_getW, 0, 0, 0) -ZEND_END_ARG_INFO() -#endif ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_WriteConcern_getWtimeout, 0, 0, IS_LONG, 0) ZEND_END_ARG_INFO() @@ -46,17 +29,9 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_WriteConcern_serialize, 0, 0, IS_STRING, 0) ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_WriteConcern_unserialize, 0, 1, IS_VOID, 0) ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0) ZEND_END_ARG_INFO() -#endif - -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_WriteConcern_unserialize, 0, 1, IS_VOID, 0) - ZEND_ARG_INFO(0, serialized) -ZEND_END_ARG_INFO() -#endif ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_WriteConcern___unserialize, 0, 1, IS_VOID, 0) ZEND_ARG_TYPE_INFO(0, data, IS_ARRAY, 0) @@ -66,59 +41,29 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_WriteConcer ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 static ZEND_METHOD(MongoDB_Driver_WriteConcern, __construct); -#endif -#if !(PHP_VERSION_ID >= 80000) -static ZEND_METHOD(MongoDB_Driver_WriteConcern, __construct); -#endif static ZEND_METHOD(MongoDB_Driver_WriteConcern, getJournal); -#if PHP_VERSION_ID >= 80000 -static ZEND_METHOD(MongoDB_Driver_WriteConcern, getW); -#endif -#if !(PHP_VERSION_ID >= 80000) static ZEND_METHOD(MongoDB_Driver_WriteConcern, getW); -#endif static ZEND_METHOD(MongoDB_Driver_WriteConcern, getWtimeout); static ZEND_METHOD(MongoDB_Driver_WriteConcern, isDefault); static ZEND_METHOD(MongoDB_Driver_WriteConcern, __set_state); static ZEND_METHOD(MongoDB_Driver_WriteConcern, bsonSerialize); static ZEND_METHOD(MongoDB_Driver_WriteConcern, serialize); -#if PHP_VERSION_ID >= 80000 static ZEND_METHOD(MongoDB_Driver_WriteConcern, unserialize); -#endif -#if !(PHP_VERSION_ID >= 80000) -static ZEND_METHOD(MongoDB_Driver_WriteConcern, unserialize); -#endif static ZEND_METHOD(MongoDB_Driver_WriteConcern, __unserialize); static ZEND_METHOD(MongoDB_Driver_WriteConcern, __serialize); static const zend_function_entry class_MongoDB_Driver_WriteConcern_methods[] = { -#if PHP_VERSION_ID >= 80000 - ZEND_ME(MongoDB_Driver_WriteConcern, __construct, arginfo_class_MongoDB_Driver_WriteConcern___construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if !(PHP_VERSION_ID >= 80000) ZEND_ME(MongoDB_Driver_WriteConcern, __construct, arginfo_class_MongoDB_Driver_WriteConcern___construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif ZEND_ME(MongoDB_Driver_WriteConcern, getJournal, arginfo_class_MongoDB_Driver_WriteConcern_getJournal, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#if PHP_VERSION_ID >= 80000 ZEND_ME(MongoDB_Driver_WriteConcern, getW, arginfo_class_MongoDB_Driver_WriteConcern_getW, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if !(PHP_VERSION_ID >= 80000) - ZEND_ME(MongoDB_Driver_WriteConcern, getW, arginfo_class_MongoDB_Driver_WriteConcern_getW, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif ZEND_ME(MongoDB_Driver_WriteConcern, getWtimeout, arginfo_class_MongoDB_Driver_WriteConcern_getWtimeout, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_Driver_WriteConcern, isDefault, arginfo_class_MongoDB_Driver_WriteConcern_isDefault, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_Driver_WriteConcern, __set_state, arginfo_class_MongoDB_Driver_WriteConcern___set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_Driver_WriteConcern, bsonSerialize, arginfo_class_MongoDB_Driver_WriteConcern_bsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_Driver_WriteConcern, serialize, arginfo_class_MongoDB_Driver_WriteConcern_serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#if PHP_VERSION_ID >= 80000 - ZEND_ME(MongoDB_Driver_WriteConcern, unserialize, arginfo_class_MongoDB_Driver_WriteConcern_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if !(PHP_VERSION_ID >= 80000) ZEND_ME(MongoDB_Driver_WriteConcern, unserialize, arginfo_class_MongoDB_Driver_WriteConcern_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif ZEND_ME(MongoDB_Driver_WriteConcern, __unserialize, arginfo_class_MongoDB_Driver_WriteConcern___unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_Driver_WriteConcern, __serialize, arginfo_class_MongoDB_Driver_WriteConcern___serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_FE_END diff --git a/src/MongoDB/WriteError.c b/src/MongoDB/WriteError.c index 08aa12d14..5db082d20 100644 --- a/src/MongoDB/WriteError.c +++ b/src/MongoDB/WriteError.c @@ -110,13 +110,13 @@ static zend_object* php_phongo_writeerror_create_object(zend_class_entry* class_ return &intern->std; } -static HashTable* php_phongo_writeerror_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) +static HashTable* php_phongo_writeerror_get_debug_info(zend_object* object, int* is_temp) { php_phongo_writeerror_t* intern; zval retval = ZVAL_STATIC_INIT; *is_temp = 1; - intern = Z_OBJ_WRITEERROR(PHONGO_COMPAT_GET_OBJ(object)); + intern = Z_OBJ_WRITEERROR(object); array_init_size(&retval, 3); ADD_ASSOC_STRING(&retval, "message", intern->message); @@ -136,7 +136,6 @@ void php_phongo_writeerror_init_ce(INIT_FUNC_ARGS) { php_phongo_writeerror_ce = register_class_MongoDB_Driver_WriteError(); php_phongo_writeerror_ce->create_object = php_phongo_writeerror_create_object; - PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_writeerror_ce); memcpy(&php_phongo_handler_writeerror, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); php_phongo_handler_writeerror.get_debug_info = php_phongo_writeerror_get_debug_info; diff --git a/src/MongoDB/WriteError.stub.php b/src/MongoDB/WriteError.stub.php index 7714b29f8..5cfa3335c 100644 --- a/src/MongoDB/WriteError.stub.php +++ b/src/MongoDB/WriteError.stub.php @@ -7,6 +7,7 @@ namespace MongoDB\Driver; +/** @not-serializable */ final class WriteError { final private function __construct() {} diff --git a/src/MongoDB/WriteError_arginfo.h b/src/MongoDB/WriteError_arginfo.h index af3126658..768f18b1f 100644 --- a/src/MongoDB/WriteError_arginfo.h +++ b/src/MongoDB/WriteError_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: ec2ba6690be6d39737b4a55eb360296784ec9e00 */ + * Stub hash: 8f9ebc299c90e86c6a55ea39e02d5a1734d10402 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_WriteError___construct, 0, 0, 0) ZEND_END_ARG_INFO() @@ -38,7 +38,7 @@ static zend_class_entry *register_class_MongoDB_Driver_WriteError(void) INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "WriteError", class_MongoDB_Driver_WriteError_methods); class_entry = zend_register_internal_class_ex(&ce, NULL); - class_entry->ce_flags |= ZEND_ACC_FINAL; + class_entry->ce_flags |= ZEND_ACC_FINAL|ZEND_ACC_NOT_SERIALIZABLE; return class_entry; } diff --git a/src/MongoDB/WriteResult.c b/src/MongoDB/WriteResult.c index c20a839a1..3b6324b31 100644 --- a/src/MongoDB/WriteResult.c +++ b/src/MongoDB/WriteResult.c @@ -356,13 +356,13 @@ static zend_object* php_phongo_writeresult_create_object(zend_class_entry* class return &intern->std; } -static HashTable* php_phongo_writeresult_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) +static HashTable* php_phongo_writeresult_get_debug_info(zend_object* object, int* is_temp) { php_phongo_writeresult_t* intern; zval retval = ZVAL_STATIC_INIT; bson_iter_t iter; - intern = Z_OBJ_WRITERESULT(PHONGO_COMPAT_GET_OBJ(object)); + intern = Z_OBJ_WRITERESULT(object); *is_temp = 1; array_init_size(&retval, 10); @@ -437,7 +437,6 @@ void php_phongo_writeresult_init_ce(INIT_FUNC_ARGS) { php_phongo_writeresult_ce = register_class_MongoDB_Driver_WriteResult(); php_phongo_writeresult_ce->create_object = php_phongo_writeresult_create_object; - PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_writeresult_ce); memcpy(&php_phongo_handler_writeresult, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); php_phongo_handler_writeresult.get_debug_info = php_phongo_writeresult_get_debug_info; diff --git a/src/MongoDB/WriteResult.stub.php b/src/MongoDB/WriteResult.stub.php index 9c5b84080..50be751f5 100644 --- a/src/MongoDB/WriteResult.stub.php +++ b/src/MongoDB/WriteResult.stub.php @@ -7,6 +7,7 @@ namespace MongoDB\Driver; +/** @not-serializable */ final class WriteResult { final private function __construct() {} diff --git a/src/MongoDB/WriteResult_arginfo.h b/src/MongoDB/WriteResult_arginfo.h index 60a67ac7f..eff3e9c59 100644 --- a/src/MongoDB/WriteResult_arginfo.h +++ b/src/MongoDB/WriteResult_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 7d27d88c75113a6642641e8502aff99c2781aa55 */ + * Stub hash: 84f1690181585d88c4e7233a4c959d5f50dc1b40 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_WriteResult___construct, 0, 0, 0) ZEND_END_ARG_INFO() @@ -68,7 +68,7 @@ static zend_class_entry *register_class_MongoDB_Driver_WriteResult(void) INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "WriteResult", class_MongoDB_Driver_WriteResult_methods); class_entry = zend_register_internal_class_ex(&ce, NULL); - class_entry->ce_flags |= ZEND_ACC_FINAL; + class_entry->ce_flags |= ZEND_ACC_FINAL|ZEND_ACC_NOT_SERIALIZABLE; return class_entry; } diff --git a/src/functions.stub.php b/src/functions.stub.php index f88737c0d..2ecff0cfe 100644 --- a/src/functions.stub.php +++ b/src/functions.stub.php @@ -6,16 +6,8 @@ /** @deprecated use MongoDB\BSON\Document::fromJSON instead */ function fromJSON(string $json): string {} -#if PHP_VERSION_ID >= 80000 /** @deprecated use MongoDB\BSON\Document::fromPHP instead */ function fromPHP(array|object $value): string {} -#else - /** - * @param array|object $value - * @deprecated use MongoDB\BSON\Document::fromPHP instead - */ - function fromPHP($value): string {} -#endif /** @deprecated use MongoDB\BSON\Document::toCanonicalExtendedJSON instead */ function toCanonicalExtendedJSON(string $bson): string {} @@ -23,16 +15,8 @@ function toCanonicalExtendedJSON(string $bson): string {} /** @deprecated */ function toJSON(string $bson): string {} -#if PHP_VERSION_ID >= 80000 /** @deprecated use MongoDB\BSON\Document::toPHP instead */ function toPHP(string $bson, ?array $typemap = null): array|object {} -#else - /** - * @return array|object - * @deprecated use MongoDB\BSON\Document::toPHP instead - */ - function toPHP(string $bson, ?array $typemap = null) {} -#endif /** @deprecated use MongoDB\BSON\Document::toRelaxedExtendedJSON instead */ function toRelaxedExtendedJSON(string $bson): string {} diff --git a/src/functions_arginfo.h b/src/functions_arginfo.h index 3f1c817f6..bf1fc03cc 100644 --- a/src/functions_arginfo.h +++ b/src/functions_arginfo.h @@ -1,21 +1,13 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: aa1e54b86d6186cc8b0d7c4042ec6daaa177b0ef */ + * Stub hash: 4d9c8b8131126ce2e67fe1659205aaf7eee8c14e */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_MongoDB_BSON_fromJSON, 0, 1, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, json, IS_STRING, 0) ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_MongoDB_BSON_fromPHP, 0, 1, IS_STRING, 0) ZEND_ARG_TYPE_MASK(0, value, MAY_BE_ARRAY|MAY_BE_OBJECT, NULL) ZEND_END_ARG_INFO() -#endif - -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_MongoDB_BSON_fromPHP, 0, 1, IS_STRING, 0) - ZEND_ARG_INFO(0, value) -ZEND_END_ARG_INFO() -#endif ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_MongoDB_BSON_toCanonicalExtendedJSON, 0, 1, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, bson, IS_STRING, 0) @@ -23,19 +15,10 @@ ZEND_END_ARG_INFO() #define arginfo_MongoDB_BSON_toJSON arginfo_MongoDB_BSON_toCanonicalExtendedJSON -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_MongoDB_BSON_toPHP, 0, 1, MAY_BE_ARRAY|MAY_BE_OBJECT) ZEND_ARG_TYPE_INFO(0, bson, IS_STRING, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, typemap, IS_ARRAY, 1, "null") ZEND_END_ARG_INFO() -#endif - -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_INFO_EX(arginfo_MongoDB_BSON_toPHP, 0, 0, 1) - ZEND_ARG_TYPE_INFO(0, bson, IS_STRING, 0) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, typemap, IS_ARRAY, 1, "null") -ZEND_END_ARG_INFO() -#endif #define arginfo_MongoDB_BSON_toRelaxedExtendedJSON arginfo_MongoDB_BSON_toCanonicalExtendedJSON @@ -53,20 +36,10 @@ ZEND_END_ARG_INFO() ZEND_FUNCTION(MongoDB_BSON_fromJSON); -#if PHP_VERSION_ID >= 80000 -ZEND_FUNCTION(MongoDB_BSON_fromPHP); -#endif -#if !(PHP_VERSION_ID >= 80000) ZEND_FUNCTION(MongoDB_BSON_fromPHP); -#endif ZEND_FUNCTION(MongoDB_BSON_toCanonicalExtendedJSON); ZEND_FUNCTION(MongoDB_BSON_toJSON); -#if PHP_VERSION_ID >= 80000 -ZEND_FUNCTION(MongoDB_BSON_toPHP); -#endif -#if !(PHP_VERSION_ID >= 80000) ZEND_FUNCTION(MongoDB_BSON_toPHP); -#endif ZEND_FUNCTION(MongoDB_BSON_toRelaxedExtendedJSON); ZEND_FUNCTION(MongoDB_Driver_Monitoring_addSubscriber); ZEND_FUNCTION(MongoDB_Driver_Monitoring_mongoc_log); @@ -75,20 +48,10 @@ ZEND_FUNCTION(MongoDB_Driver_Monitoring_removeSubscriber); static const zend_function_entry ext_functions[] = { ZEND_NS_DEP_FALIAS("MongoDB\\BSON", fromJSON, MongoDB_BSON_fromJSON, arginfo_MongoDB_BSON_fromJSON) -#if PHP_VERSION_ID >= 80000 ZEND_NS_DEP_FALIAS("MongoDB\\BSON", fromPHP, MongoDB_BSON_fromPHP, arginfo_MongoDB_BSON_fromPHP) -#endif -#if !(PHP_VERSION_ID >= 80000) - ZEND_NS_DEP_FALIAS("MongoDB\\BSON", fromPHP, MongoDB_BSON_fromPHP, arginfo_MongoDB_BSON_fromPHP) -#endif ZEND_NS_DEP_FALIAS("MongoDB\\BSON", toCanonicalExtendedJSON, MongoDB_BSON_toCanonicalExtendedJSON, arginfo_MongoDB_BSON_toCanonicalExtendedJSON) ZEND_NS_DEP_FALIAS("MongoDB\\BSON", toJSON, MongoDB_BSON_toJSON, arginfo_MongoDB_BSON_toJSON) -#if PHP_VERSION_ID >= 80000 - ZEND_NS_DEP_FALIAS("MongoDB\\BSON", toPHP, MongoDB_BSON_toPHP, arginfo_MongoDB_BSON_toPHP) -#endif -#if !(PHP_VERSION_ID >= 80000) ZEND_NS_DEP_FALIAS("MongoDB\\BSON", toPHP, MongoDB_BSON_toPHP, arginfo_MongoDB_BSON_toPHP) -#endif ZEND_NS_DEP_FALIAS("MongoDB\\BSON", toRelaxedExtendedJSON, MongoDB_BSON_toRelaxedExtendedJSON, arginfo_MongoDB_BSON_toRelaxedExtendedJSON) ZEND_NS_FALIAS("MongoDB\\Driver\\Monitoring", addSubscriber, MongoDB_Driver_Monitoring_addSubscriber, arginfo_MongoDB_Driver_Monitoring_addSubscriber) ZEND_NS_FALIAS("MongoDB\\Driver\\Monitoring", mongoc_log, MongoDB_Driver_Monitoring_mongoc_log, arginfo_MongoDB_Driver_Monitoring_mongoc_log) diff --git a/src/phongo_apm.c b/src/phongo_apm.c index b0c3d1a6c..87ce327f0 100644 --- a/src/phongo_apm.c +++ b/src/phongo_apm.c @@ -120,7 +120,7 @@ static void phongo_apm_dispatch_event(HashTable* subscribers, const char* functi /* We can't use the zend_call_method_with_1_params macro here, as it * assumes the function name is a string literal. */ - zend_call_method(PHONGO_COMPAT_OBJ_P(subscriber), NULL, NULL, function_name, strlen(function_name), NULL, 1, event, NULL); + zend_call_method(Z_OBJ_P(subscriber), NULL, NULL, function_name, strlen(function_name), NULL, 1, event, NULL); } ZEND_HASH_FOREACH_END(); } @@ -264,8 +264,8 @@ static void phongo_apm_command_failed(const mongoc_apm_command_failed_t* event) mongoc_apm_command_failed_get_error(event, &tmp_error); object_init_ex(&p_event->z_error, phongo_exception_from_mongoc_domain(tmp_error.domain, tmp_error.code)); - zend_update_property_string(zend_ce_exception, PHONGO_COMPAT_OBJ_P(&p_event->z_error), ZEND_STRL("message"), tmp_error.message); - zend_update_property_long(zend_ce_exception, PHONGO_COMPAT_OBJ_P(&p_event->z_error), ZEND_STRL("code"), tmp_error.code); + zend_update_property_string(zend_ce_exception, Z_OBJ_P(&p_event->z_error), ZEND_STRL("message"), tmp_error.message); + zend_update_property_long(zend_ce_exception, Z_OBJ_P(&p_event->z_error), ZEND_STRL("code"), tmp_error.code); phongo_apm_dispatch_event(subscribers, "commandFailed", &z_event); zval_ptr_dtor(&z_event); @@ -364,8 +364,8 @@ static void phongo_apm_server_heartbeat_failed(const mongoc_apm_server_heartbeat mongoc_apm_server_heartbeat_failed_get_error(event, &tmp_error); object_init_ex(&p_event->z_error, phongo_exception_from_mongoc_domain(tmp_error.domain, tmp_error.code)); - zend_update_property_string(zend_ce_exception, PHONGO_COMPAT_OBJ_P(&p_event->z_error), ZEND_STRL("message"), tmp_error.message); - zend_update_property_long(zend_ce_exception, PHONGO_COMPAT_OBJ_P(&p_event->z_error), ZEND_STRL("code"), tmp_error.code); + zend_update_property_string(zend_ce_exception, Z_OBJ_P(&p_event->z_error), ZEND_STRL("message"), tmp_error.message); + zend_update_property_long(zend_ce_exception, Z_OBJ_P(&p_event->z_error), ZEND_STRL("code"), tmp_error.code); phongo_apm_dispatch_event(subscribers, "serverHeartbeatFailed", &z_event); zval_ptr_dtor(&z_event); diff --git a/src/phongo_bson.c b/src/phongo_bson.c index 84c9a4d0d..62b9cdceb 100644 --- a/src/phongo_bson.c +++ b/src/phongo_bson.c @@ -17,9 +17,7 @@ #include "bson/bson.h" #include -#if PHP_VERSION_ID >= 80100 #include -#endif #include #include @@ -67,11 +65,9 @@ static inline bool phongo_is_class_instantiatable(const zend_class_entry* ce) return false; } -#if PHP_VERSION_ID >= 80100 if (ce->ce_flags & ZEND_ACC_ENUM) { return false; } -#endif /* PHP_VERSION_ID < 80100 */ return true; } @@ -776,7 +772,7 @@ static bool php_phongo_bson_visit_document(const bson_iter_t* iter ARG_UNUSED, c object_init_ex(&obj, obj_ce); - zend_call_method_with_1_params(PHONGO_COMPAT_OBJ_P(&obj), NULL, NULL, BSON_UNSERIALIZE_FUNC_NAME, NULL, &state.zchild); + zend_call_method_with_1_params(Z_OBJ_P(&obj), NULL, NULL, BSON_UNSERIALIZE_FUNC_NAME, NULL, &state.zchild); zval_ptr_dtor(&state.zchild); ZVAL_COPY_VALUE(&state.zchild, &obj); @@ -856,7 +852,7 @@ static bool php_phongo_bson_visit_array(const bson_iter_t* iter ARG_UNUSED, cons zval obj; object_init_ex(&obj, state.field_type.ce); - zend_call_method_with_1_params(PHONGO_COMPAT_OBJ_P(&obj), NULL, NULL, BSON_UNSERIALIZE_FUNC_NAME, NULL, &state.zchild); + zend_call_method_with_1_params(Z_OBJ_P(&obj), NULL, NULL, BSON_UNSERIALIZE_FUNC_NAME, NULL, &state.zchild); zval_ptr_dtor(&state.zchild); ZVAL_COPY_VALUE(&state.zchild, &obj); break; @@ -1147,7 +1143,7 @@ bool php_phongo_bson_to_zval_ex(const bson_t* b, php_phongo_bson_state* state) object_init_ex(&obj, obj_ce); - zend_call_method_with_1_params(PHONGO_COMPAT_OBJ_P(&obj), NULL, NULL, BSON_UNSERIALIZE_FUNC_NAME, NULL, &state->zchild); + zend_call_method_with_1_params(Z_OBJ_P(&obj), NULL, NULL, BSON_UNSERIALIZE_FUNC_NAME, NULL, &state->zchild); zval_ptr_dtor(&state->zchild); ZVAL_COPY_VALUE(&state->zchild, &obj); diff --git a/src/phongo_bson_encode.c b/src/phongo_bson_encode.c index 6e1686426..77f3551ec 100644 --- a/src/phongo_bson_encode.c +++ b/src/phongo_bson_encode.c @@ -17,9 +17,7 @@ #include "bson/bson.h" #include -#if PHP_VERSION_ID >= 80100 #include -#endif #include #include "php_phongo.h" @@ -93,7 +91,7 @@ static int php_phongo_is_array_or_document(zval* val) /* Checks the return type of a bsonSerialize() method. Returns true on * success; otherwise, throws an exception and returns false. * - * TODO: obsolete once PHP 8.0+ is required and tentative return type is enforced. + * TODO: obsolete once the tentative return type in Serializable::bsonSerialize is enforced. */ static inline bool phongo_check_bson_serialize_return_type(zval* retval, zend_class_entry* ce) { @@ -173,7 +171,7 @@ static void php_phongo_bson_append_object(bson_t* bson, php_phongo_field_path* f zval obj_data; bson_t child; - zend_call_method_with_0_params(PHONGO_COMPAT_OBJ_P(object), NULL, NULL, BSON_SERIALIZE_FUNC_NAME, &obj_data); + zend_call_method_with_0_params(Z_OBJ_P(object), NULL, NULL, BSON_SERIALIZE_FUNC_NAME, &obj_data); if (Z_ISUNDEF(obj_data)) { /* zend_call_method() failed or bsonSerialize() threw an @@ -293,7 +291,6 @@ static void php_phongo_bson_append_object(bson_t* bson, php_phongo_field_path* f return; } -#if PHP_VERSION_ID >= 80100 if (Z_TYPE_P(object) == IS_OBJECT && Z_OBJCE_P(object)->ce_flags & ZEND_ACC_ENUM) { if (Z_OBJCE_P(object)->enum_backing_type == IS_UNDEF) { char* path_string = php_phongo_field_path_as_string(field_path); @@ -305,7 +302,6 @@ static void php_phongo_bson_append_object(bson_t* bson, php_phongo_field_path* f php_phongo_bson_append(bson, field_path, flags, key, key_len, zend_enum_fetch_case_value(Z_OBJ_P(object))); return; } -#endif /* PHP_VERSION_ID >= 80100 */ { bson_t child; @@ -485,7 +481,7 @@ static void php_phongo_zval_to_bson_internal(zval* data, php_phongo_field_path* /* For any MongoDB\BSON\Serializable, invoke the bsonSerialize method * and work with the result. */ if (instanceof_function(Z_OBJCE_P(data), php_phongo_serializable_ce)) { - zend_call_method_with_0_params(PHONGO_COMPAT_OBJ_P(data), NULL, NULL, BSON_SERIALIZE_FUNC_NAME, &obj_data); + zend_call_method_with_0_params(Z_OBJ_P(data), NULL, NULL, BSON_SERIALIZE_FUNC_NAME, &obj_data); if (Z_ISUNDEF(obj_data)) { /* zend_call_method() failed or bsonSerialize() threw an @@ -520,19 +516,17 @@ static void php_phongo_zval_to_bson_internal(zval* data, php_phongo_field_path* /* For the error handling that follows, we can safely assume that we * are at the root level, since php_phongo_bson_append_object would * have already been called for a non-root level. */ -#if PHP_VERSION_ID >= 80100 if (Z_OBJCE_P(data)->ce_flags & ZEND_ACC_ENUM) { phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "Enum %s cannot be serialized as a root element", ZSTR_VAL(Z_OBJCE_P(data)->name)); return; } -#endif /* PHP_VERSION_ID >= 80100 */ if (instanceof_function(Z_OBJCE_P(data), php_phongo_type_ce)) { phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "%s instance %s cannot be serialized as a root element", ZSTR_VAL(php_phongo_type_ce->name), ZSTR_VAL(Z_OBJCE_P(data)->name)); return; } - ht_data = Z_OBJ_HT_P(data)->get_properties(PHONGO_COMPAT_OBJ_P(data)); + ht_data = Z_OBJ_HT_P(data)->get_properties(Z_OBJ_P(data)); ht_data_from_properties = true; break; diff --git a/src/phongo_compat.c b/src/phongo_compat.c index 710fe7957..c5e8b8fa8 100644 --- a/src/phongo_compat.c +++ b/src/phongo_compat.c @@ -49,51 +49,9 @@ const char* zend_get_object_type_case(const zend_class_entry* ce, zend_bool uppe if (ce->ce_flags & ZEND_ACC_INTERFACE) { return upper_case ? "Interface" : "interface"; } -#if PHP_VERSION_ID >= 80100 if (ce->ce_flags & ZEND_ACC_ENUM) { return upper_case ? "Enum" : "enum"; } -#endif /* PHP_VERSION_ID > 80100 */ return upper_case ? "Class" : "class"; } #endif /* PHP_VERSION_ID < 80200 */ - -#if PHP_VERSION_ID < 80100 -zend_bool zend_array_is_list(zend_array* array) -{ - zend_ulong expected_idx = 0; - zend_ulong num_idx; - zend_string* str_idx; - /* Empty arrays are lists */ - if (zend_hash_num_elements(array) == 0) { - return 1; - } - - ZEND_HASH_FOREACH_KEY(array, num_idx, str_idx) - { - if (str_idx != NULL || num_idx != expected_idx++) { - return 0; - } - } - ZEND_HASH_FOREACH_END(); - - return 1; -} -#endif /* PHP_VERSION_ID < 80100 */ - -#if PHP_VERSION_ID < 80000 -zend_string* zend_string_concat3(const char* str1, size_t str1_len, const char* str2, size_t str2_len, const char* str3, size_t str3_len) -{ - size_t len = str1_len + str2_len + str3_len; - zend_string* res = zend_string_alloc(len, 0); - - memcpy(ZSTR_VAL(res), str1, str1_len); - memcpy(ZSTR_VAL(res) + str1_len, str2, str2_len); - memcpy(ZSTR_VAL(res) + str1_len + str2_len, str3, str3_len); - /* clang-format off */ - ZSTR_VAL(res)[len] = '\0'; - /* clang-format on */ - - return res; -} -#endif /* PHP_VERSION_ID < 80000 */ diff --git a/src/phongo_compat.h b/src/phongo_compat.h index 0b51eace7..f640c6bed 100644 --- a/src/phongo_compat.h +++ b/src/phongo_compat.h @@ -65,31 +65,6 @@ #define PHONGO_BREAK_INTENTIONALLY_MISSING #endif -#if PHP_VERSION_ID >= 80000 -#define PHONGO_COMPAT_OBJ_P(val) Z_OBJ_P(val) -#define phongo_compat_object_handler_type zend_object -#define PHONGO_COMPAT_GET_OBJ(val) val -#define PHONGO_COMPAT_SET_COMPARE_OBJECTS_HANDLER(type) php_phongo_handler_##type.compare = php_phongo_##type##_compare_objects; -#define phongo_compat_property_accessor_name_type zend_string -#define PHONGO_COMPAT_PROPERTY_ACCESSOR_NAME_TO_STRING(value, key, len) \ - do { \ - (key) = ZSTR_VAL((value)); \ - (len) = ZSTR_LEN((value)); \ - } while (0) -#else /* PHP_VERSION_ID < 80000 */ -#define PHONGO_COMPAT_OBJ_P(val) val -#define phongo_compat_object_handler_type zval -#define PHONGO_COMPAT_GET_OBJ(val) Z_OBJ_P(val) -#define PHONGO_COMPAT_SET_COMPARE_OBJECTS_HANDLER(type) php_phongo_handler_##type.compare_objects = php_phongo_##type##_compare_objects; -#define ZEND_COMPARE_OBJECTS_FALLBACK(o1, o2) -#define phongo_compat_property_accessor_name_type zval -#define PHONGO_COMPAT_PROPERTY_ACCESSOR_NAME_TO_STRING(value, key, len) \ - do { \ - (key) = Z_STRVAL_P((value)); \ - (len) = Z_STRLEN_P((value)); \ - } while (0) -#endif /* PHP_VERSION_ID >= 80000 */ - #if SIZEOF_ZEND_LONG == 8 #define PHONGO_LONG_FORMAT PRId64 #elif SIZEOF_ZEND_LONG == 4 @@ -233,70 +208,6 @@ } while (0) #endif -/* Z_PARAM_*_OR_NULL macros were introduced in PHP 8.0. - * See: https://github.com/php/php-src/commit/e93d20ad7ebc1075ef1248a663935ee5ea69f1cd */ -#ifndef Z_PARAM_OBJECT_OF_CLASS_OR_NULL -#define Z_PARAM_OBJECT_OF_CLASS_OR_NULL(dest, _ce) \ - Z_PARAM_OBJECT_OF_CLASS_EX(dest, _ce, 1, 0) -#endif -#ifndef Z_PARAM_STRING_OR_NULL -#define Z_PARAM_STRING_OR_NULL(dest, dest_len) \ - Z_PARAM_STRING_EX(dest, dest_len, 1, 0) -#endif -#ifndef Z_PARAM_ARRAY_OR_NULL -#define Z_PARAM_ARRAY_OR_NULL(dest) \ - Z_PARAM_ARRAY_EX(dest, 1, 0) -#endif -#ifndef Z_PARAM_ZVAL_OR_NULL -#define Z_PARAM_ZVAL_OR_NULL(dest) \ - Z_PARAM_ZVAL_EX(dest, 1, 0) -#endif - -/* ZEND_ABSTRACT_ME_WITH_FLAGS was introduced in PHP 8.0. */ -#ifndef ZEND_ABSTRACT_ME_WITH_FLAGS -#define ZEND_ABSTRACT_ME_WITH_FLAGS(classname, name, arg_info, flags) ZEND_RAW_FENTRY(#name, NULL, arg_info, flags) -#endif - -/* ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE was introduced in PHP 8.0. */ -#ifndef ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE -#define ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(pass_by_ref, name, type_hint, allow_null, default_value) \ - ZEND_ARG_TYPE_INFO(pass_by_ref, name, type_hint, allow_null) -#endif - -/* ZEND_ARG_INFO_WITH_DEFAULT_VALUE was introduced in PHP 8.0. */ -#ifndef ZEND_ARG_INFO_WITH_DEFAULT_VALUE -#define ZEND_ARG_INFO_WITH_DEFAULT_VALUE(pass_by_ref, name, default_value) \ - ZEND_ARG_INFO(pass_by_ref, name) -#endif - -/* ZEND_ARG_OBJ_INFO_WITH_DEFAULT_VALUE was introduced in PHP 8.0. */ -#ifndef ZEND_ARG_OBJ_INFO_WITH_DEFAULT_VALUE -#define ZEND_ARG_OBJ_INFO_WITH_DEFAULT_VALUE(pass_by_ref, name, classname, allow_null, default_value) \ - ZEND_ARG_OBJ_INFO(pass_by_ref, name, classname, allow_null) -#endif - -/* The ZEND_BEGIN_ARG_WITH_TENTATIVE_* set of macros was introduced in PHP 8.1 */ -#ifndef ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX -#define ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(name, return_reference, required_num_args, type, allow_null) \ - ZEND_BEGIN_ARG_INFO_EX(name, 0, return_reference, required_num_args) -#endif -#ifndef ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX -#define ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(name, return_reference, required_num_args, type, allow_null) \ - ZEND_BEGIN_ARG_INFO_EX(name, 0, return_reference, required_num_args) -#endif -#ifndef ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_MASK_EX -#define ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_MASK_EX(name, return_reference, required_num_args, type) \ - ZEND_BEGIN_ARG_INFO_EX(name, 0, return_reference, required_num_args) -#endif -#ifndef ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_OBJ_INFO_EX -#define ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_OBJ_INFO_EX(name, return_reference, required_num_args, class_name, allow_null) \ - ZEND_BEGIN_ARG_INFO_EX(name, 0, return_reference, required_num_args) -#endif -#ifndef ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_OBJ_TYPE_MASK_EX -#define ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_OBJ_TYPE_MASK_EX(name, return_reference, required_num_args, class_name, type) \ - ZEND_BEGIN_ARG_INFO_EX(name, 0, return_reference, required_num_args) -#endif - zend_bool php_phongo_zend_hash_apply_protection_begin(HashTable* ht); zend_bool php_phongo_zend_hash_apply_protection_end(HashTable* ht); @@ -307,55 +218,4 @@ const char* zend_get_object_type_case(const zend_class_entry* ce, zend_bool uppe #define zend_get_object_type_uc(ce) zend_get_object_type_case((ce), true) #endif /* PHP_VERSION_ID < 80200 */ -#if PHP_VERSION_ID < 80100 -zend_bool zend_array_is_list(zend_array* array); -#endif /* PHP_VERSION_ID < 80100 */ - -#if PHP_VERSION_ID < 80000 -typedef ZEND_RESULT_CODE zend_result; -#endif - -/* get_gc iterator handler was added in PHP 8.0 */ -#if PHP_VERSION_ID >= 80000 -#define PHONGO_ITERATOR_FUNCS(dtor, valid, get_current_data, get_current_key, move_forward, rewind, invalidate_current, get_gc) \ - { \ - (dtor), \ - (valid), \ - (get_current_data), \ - (get_current_key), \ - (move_forward), \ - (rewind), \ - (invalidate_current), \ - (get_gc), \ - } -#else /* PHP_VERSION_ID < 80000 */ -#define PHONGO_ITERATOR_FUNCS(dtor, valid, get_current_data, get_current_key, move_forward, rewind, invalidate_current, get_gc) \ - { \ - (dtor), \ - (valid), \ - (get_current_data), \ - (get_current_key), \ - (move_forward), \ - (rewind), \ - (invalidate_current), \ - } -#endif /* PHP_VERSION_ID >= 80000 */ - -/* ZVAL_OBJ_COPY was added in PHP 8.0 */ -#ifndef ZVAL_OBJ_COPY -#define ZVAL_OBJ_COPY(z, o) \ - do { \ - zval* __z = (z); \ - zend_object* __o = (o); \ - GC_ADDREF(__o); \ - Z_OBJ_P(__z) = __o; \ - Z_TYPE_INFO_P(__z) = IS_OBJECT_EX; \ - } while (0) -#endif - -/* zend_string_concat functions were introduced in PHP 8.0 */ -#if PHP_VERSION_ID < 80000 -zend_string* zend_string_concat3(const char* str1, size_t str1_len, const char* str2, size_t str2_len, const char* str3, size_t str3_len); -#endif /* PHP_VERSION_ID < 80000 */ - #endif /* PHONGO_COMPAT_H */ diff --git a/src/phongo_error.c b/src/phongo_error.c index 76be9f81b..d50e10d86 100644 --- a/src/phongo_error.c +++ b/src/phongo_error.c @@ -32,7 +32,7 @@ void phongo_add_exception_prop(const char* prop, int prop_len, zval* value) if (EG(exception)) { zval ex; ZVAL_OBJ(&ex, EG(exception)); - zend_update_property(Z_OBJCE(ex), PHONGO_COMPAT_OBJ_P(&ex), prop, prop_len, value); + zend_update_property(Z_OBJCE(ex), Z_OBJ_P(&ex), prop, prop_len, value); } } diff --git a/tests/bson/bson-enum-001.phpt b/tests/bson/bson-enum-001.phpt index 1374d2013..175dbccc8 100644 --- a/tests/bson/bson-enum-001.phpt +++ b/tests/bson/bson-enum-001.phpt @@ -1,8 +1,5 @@ --TEST-- Backed enums serialize as their case value ---SKIPIF-- - - --FILE-- - --FILE-- - --FILE-- - --FILE-- - --FILE-- - --FILE-- - --FILE-- - --FILE-- - --FILE-- - +MongoDB\BSON\Int64 operation errors --FILE-- ) ---SKIPIF-- - -=', '8.0'); ?> ---FILE-- - -===DONE=== - ---EXPECTF-- -OK: Got E_WARNING -A non-numeric value encountered -OK: Got DivisionByZeroError -Division by zero -===DONE=== diff --git a/tests/bson/bson-toPHP-014.phpt b/tests/bson/bson-toPHP-014.phpt index 7b18987e7..8fd6265c1 100644 --- a/tests/bson/bson-toPHP-014.phpt +++ b/tests/bson/bson-toPHP-014.phpt @@ -1,8 +1,5 @@ --TEST-- Uninstantiatable classes are ignored when processing __pclass (enums) ---SKIPIF-- - - --FILE-- - --FILE-- -=', '8.1'); ?> ---FILE-- - &$rootValue, 'document' => &$documentValue]; - - return $typemap; -} - -$typemap = createTypemap(); -$bson = MongoDB\BSON\Document::fromPHP((object) []); - -echo "Before:\n"; -debug_zval_dump($typemap); - -$bson->toPHP($typemap); - -echo "After:\n"; -debug_zval_dump($typemap); - -?> -===DONE=== - ---EXPECT-- -Before: -array(2) refcount(2){ - ["root"]=> - string(5) "array" refcount(1) - ["document"]=> - string(5) "array" refcount(1) -} -After: -array(2) refcount(2){ - ["root"]=> - string(5) "array" refcount(1) - ["document"]=> - string(5) "array" refcount(1) -} -===DONE=== diff --git a/tests/bson/bug1839-002.phpt b/tests/bson/bug1839-002.phpt deleted file mode 100644 index dc24f8756..000000000 --- a/tests/bson/bug1839-002.phpt +++ /dev/null @@ -1,43 +0,0 @@ ---TEST-- -PHPC-1839: Referenced, local, non-interned string in typeMap (PHP < 8.1) ---SKIPIF-- - -=', '8.1'); ?> ---FILE-- - &$rootValue, 'document' => &$documentValue]; -$bson = MongoDB\BSON\Document::fromPHP((object) []); - -echo "Before:\n"; -debug_zval_dump($typemap); - -$bson->toPHP($typemap); - -echo "After:\n"; -debug_zval_dump($typemap); - -?> -===DONE=== - ---EXPECT-- -Before: -array(2) refcount(2){ - ["root"]=> - &string(5) "array" refcount(1) - ["document"]=> - &string(5) "array" refcount(1) -} -After: -array(2) refcount(2){ - ["root"]=> - &string(5) "array" refcount(1) - ["document"]=> - &string(5) "array" refcount(1) -} -===DONE=== diff --git a/tests/bson/bug1839-003.phpt b/tests/bson/bug1839-003.phpt deleted file mode 100644 index f22b4d61d..000000000 --- a/tests/bson/bug1839-003.phpt +++ /dev/null @@ -1,49 +0,0 @@ ---TEST-- -PHPC-1839: Referenced, out-of-scope, interned string in typeMap (PHP < 8.1) ---SKIPIF-- - -=', '8.1'); ?> ---FILE-- - &$rootValue, 'document' => &$documentValue]; - - return $typemap; -} - -$typemap = createTypemap(); -$bson = MongoDB\BSON\Document::fromPHP((object) []); - -echo "Before:\n"; -debug_zval_dump($typemap); - -$bson->toPHP($typemap); - -echo "After:\n"; -debug_zval_dump($typemap); - -?> -===DONE=== - ---EXPECT-- -Before: -array(2) refcount(2){ - ["root"]=> - string(5) "array" refcount(1) - ["document"]=> - string(5) "array" refcount(1) -} -After: -array(2) refcount(2){ - ["root"]=> - string(5) "array" refcount(1) - ["document"]=> - string(5) "array" refcount(1) -} -===DONE=== diff --git a/tests/bson/bug1839-004.phpt b/tests/bson/bug1839-004.phpt deleted file mode 100644 index 08be06931..000000000 --- a/tests/bson/bug1839-004.phpt +++ /dev/null @@ -1,42 +0,0 @@ ---TEST-- -PHPC-1839: Referenced, local, interned string in typeMap (PHP < 8.1) ---SKIPIF-- - -=', '8.1'); ?> ---FILE-- - &$rootValue, 'document' => &$documentValue]; -$bson = MongoDB\BSON\Document::fromPHP((object) []); - -echo "Before:\n"; -debug_zval_dump($typemap); - -$bson->toPHP($typemap); - -echo "After:\n"; -debug_zval_dump($typemap); - -?> -===DONE=== - ---EXPECT-- -Before: -array(2) refcount(2){ - ["root"]=> - &string(5) "array" refcount(1) - ["document"]=> - &string(5) "array" refcount(1) -} -After: -array(2) refcount(2){ - ["root"]=> - &string(5) "array" refcount(1) - ["document"]=> - &string(5) "array" refcount(1) -} -===DONE=== diff --git a/tests/bson/bug1839-005.phpt b/tests/bson/bug1839-005.phpt index 697dbb65a..f7e35f921 100644 --- a/tests/bson/bug1839-005.phpt +++ b/tests/bson/bug1839-005.phpt @@ -1,8 +1,5 @@ --TEST-- PHPC-1839: Referenced, out-of-scope, non-interned string in typeMap (PHP >= 8.1) ---SKIPIF-- - - --FILE-- = 8.1) ---SKIPIF-- - - --FILE-- = 8.1) ---SKIPIF-- - - --FILE-- = 8.1) ---SKIPIF-- - - --FILE-- = 8.1) ---SKIPIF-- - - --FILE-- -=', '8.1'); ?> ---FILE-- - -===DONE=== - ---EXPECTF-- -OK: Got Exception -Serialization of 'MongoDB\Driver\Manager' is not allowed -OK: Got Exception -Unserialization of 'MongoDB\Driver\Manager' is not allowed -OK: Got E_WARNING -Erroneous data format for unserializing 'MongoDB\Driver\Manager' -===DONE=== diff --git a/tests/utils/skipif.php b/tests/utils/skipif.php index e7ba4d242..f758fcf30 100644 --- a/tests/utils/skipif.php +++ b/tests/utils/skipif.php @@ -17,10 +17,6 @@ function disable_skipif_caching() { static $skipifCachingDisabled; - if (PHP_VERSION_ID < 80100) { - return; - } - if (! isset($skipifCachingDisabled)) { $skipifCachingDisabled = true;