From 46c6055f967e021b3cbfc471064189cb3778ac16 Mon Sep 17 00:00:00 2001 From: Andreas Braun Date: Thu, 19 Sep 2024 20:43:52 +0200 Subject: [PATCH] PHPC-2248: Remove Serializable implementations (#1663) --- UPGRADE-2.0.md | 8 +- src/BSON/Binary.c | 58 +--------- src/BSON/Binary.stub.php | 6 +- src/BSON/Binary_arginfo.h | 16 +-- src/BSON/DBPointer.c | 58 +--------- src/BSON/DBPointer.stub.php | 6 +- src/BSON/DBPointer_arginfo.h | 16 +-- src/BSON/Decimal128.c | 59 +--------- src/BSON/Decimal128.stub.php | 6 +- src/BSON/Decimal128_arginfo.h | 16 +-- src/BSON/Document.c | 61 +---------- src/BSON/Document.stub.php | 6 +- src/BSON/Document_arginfo.h | 16 +-- src/BSON/Int64.c | 57 +--------- src/BSON/Int64.stub.php | 6 +- src/BSON/Int64_arginfo.h | 16 +-- src/BSON/Javascript.c | 70 +----------- src/BSON/Javascript.stub.php | 6 +- src/BSON/Javascript_arginfo.h | 16 +-- src/BSON/MaxKey.c | 21 +--- src/BSON/MaxKey.stub.php | 6 +- src/BSON/MaxKey_arginfo.h | 17 +-- src/BSON/MinKey.c | 21 +--- src/BSON/MinKey.stub.php | 6 +- src/BSON/MinKey_arginfo.h | 17 +-- src/BSON/ObjectId.c | 57 +--------- src/BSON/ObjectId.stub.php | 6 +- src/BSON/ObjectId_arginfo.h | 16 +-- src/BSON/PackedArray.c | 60 +--------- src/BSON/PackedArray.stub.php | 6 +- src/BSON/PackedArray_arginfo.h | 16 +-- src/BSON/Regex.c | 57 +--------- src/BSON/Regex.stub.php | 6 +- src/BSON/Regex_arginfo.h | 16 +-- src/BSON/Symbol.c | 57 +--------- src/BSON/Symbol.stub.php | 6 +- src/BSON/Symbol_arginfo.h | 16 +-- src/BSON/Timestamp.c | 65 +---------- src/BSON/Timestamp.stub.php | 6 +- src/BSON/Timestamp_arginfo.h | 16 +-- src/BSON/UTCDateTime.c | 57 +--------- src/BSON/UTCDateTime.stub.php | 6 +- src/BSON/UTCDateTime_arginfo.h | 16 +-- src/BSON/Undefined.c | 21 +--- src/BSON/Undefined.stub.php | 6 +- src/BSON/Undefined_arginfo.h | 16 +-- src/MongoDB/ReadConcern.c | 72 +----------- src/MongoDB/ReadConcern.stub.php | 6 +- src/MongoDB/ReadConcern_arginfo.h | 17 +-- src/MongoDB/ReadPreference.c | 103 +----------------- src/MongoDB/ReadPreference.stub.php | 6 +- src/MongoDB/ReadPreference_arginfo.h | 16 +-- src/MongoDB/ServerApi.c | 74 +------------ src/MongoDB/ServerApi.stub.php | 6 +- src/MongoDB/ServerApi_arginfo.h | 17 +-- src/MongoDB/WriteConcern.c | 91 +--------------- src/MongoDB/WriteConcern.stub.php | 6 +- src/MongoDB/WriteConcern_arginfo.h | 17 +-- .../bson-binary-serialization_error-001.phpt | 30 ----- .../bson-binary-serialization_error-002.phpt | 24 ---- .../bson-binary-serialization_error-003.phpt | 36 ------ ...son-dbpointer-serialization_error-001.phpt | 25 ----- ...son-dbpointer-serialization_error-002.phpt | 25 ----- ...on-decimal128-serialization_error-001.phpt | 18 --- ...on-decimal128-serialization_error-002.phpt | 18 --- .../bson-int64-serialization_error-001.phpt | 18 --- .../bson-int64-serialization_error-002.phpt | 18 --- ...on-javascript-serialization_error-001.phpt | 18 --- ...on-javascript-serialization_error-002.phpt | 18 --- ...on-javascript-serialization_error-003.phpt | 18 --- ...bson-objectid-serialization_error-001.phpt | 18 --- ...bson-objectid-serialization_error-002.phpt | 24 ---- tests/bson/bson-regex-serialization-003.phpt | 18 --- .../bson-regex-serialization_error-001.phpt | 30 ----- .../bson-regex-serialization_error-002.phpt | 26 ----- .../bson-symbol-serialization_error-001.phpt | 18 --- .../bson-symbol-serialization_error-002.phpt | 18 --- ...son-timestamp-serialization_error-001.phpt | 36 ------ ...son-timestamp-serialization_error-002.phpt | 36 ------ ...son-timestamp-serialization_error-003.phpt | 26 ----- ...son-timestamp-serialization_error-004.phpt | 24 ---- ...n-utcdatetime-serialization_error-001.phpt | 18 --- ...n-utcdatetime-serialization_error-002.phpt | 37 ------- tests/bson/bug1598-001.phpt | 6 +- tests/bson/bug1598-002.phpt | 6 +- .../manager-serialization_error-001.phpt | 6 - .../readconcern-serialization_error-001.phpt | 18 --- ...eadpreference-serialization_error-001.phpt | 28 ----- .../serverApi-serialization_error-001.phpt | 30 ----- .../serverApi-serialization_error-002.phpt | 6 +- tests/utils/tools.php | 22 ++++ .../writeconcern-serialization_error-001.phpt | 22 ---- 92 files changed, 130 insertions(+), 2159 deletions(-) delete mode 100644 tests/bson/bson-binary-serialization_error-001.phpt delete mode 100644 tests/bson/bson-binary-serialization_error-002.phpt delete mode 100644 tests/bson/bson-binary-serialization_error-003.phpt delete mode 100644 tests/bson/bson-dbpointer-serialization_error-001.phpt delete mode 100644 tests/bson/bson-dbpointer-serialization_error-002.phpt delete mode 100644 tests/bson/bson-decimal128-serialization_error-001.phpt delete mode 100644 tests/bson/bson-decimal128-serialization_error-002.phpt delete mode 100644 tests/bson/bson-int64-serialization_error-001.phpt delete mode 100644 tests/bson/bson-int64-serialization_error-002.phpt delete mode 100644 tests/bson/bson-javascript-serialization_error-001.phpt delete mode 100644 tests/bson/bson-javascript-serialization_error-002.phpt delete mode 100644 tests/bson/bson-javascript-serialization_error-003.phpt delete mode 100644 tests/bson/bson-objectid-serialization_error-001.phpt delete mode 100644 tests/bson/bson-objectid-serialization_error-002.phpt delete mode 100644 tests/bson/bson-regex-serialization-003.phpt delete mode 100644 tests/bson/bson-regex-serialization_error-001.phpt delete mode 100644 tests/bson/bson-regex-serialization_error-002.phpt delete mode 100644 tests/bson/bson-symbol-serialization_error-001.phpt delete mode 100644 tests/bson/bson-symbol-serialization_error-002.phpt delete mode 100644 tests/bson/bson-timestamp-serialization_error-001.phpt delete mode 100644 tests/bson/bson-timestamp-serialization_error-002.phpt delete mode 100644 tests/bson/bson-timestamp-serialization_error-003.phpt delete mode 100644 tests/bson/bson-timestamp-serialization_error-004.phpt delete mode 100644 tests/bson/bson-utcdatetime-serialization_error-001.phpt delete mode 100644 tests/bson/bson-utcdatetime-serialization_error-002.phpt delete mode 100644 tests/readConcern/readconcern-serialization_error-001.phpt delete mode 100644 tests/readPreference/readpreference-serialization_error-001.phpt delete mode 100644 tests/serverApi/serverApi-serialization_error-001.phpt delete mode 100644 tests/writeConcern/writeconcern-serialization_error-001.phpt diff --git a/UPGRADE-2.0.md b/UPGRADE-2.0.md index 4409967c4..c505fe6e9 100644 --- a/UPGRADE-2.0.md +++ b/UPGRADE-2.0.md @@ -23,7 +23,7 @@ UPGRADE FROM 1.x to 2.0 `MongoDB\Driver\Cursor::getId()` and `MongoDB\Driver\CursorInterface::getId()` now return a `MongoDB\BSON\Int64` instance. - -* The `--with-libbson` and `--with-libmongoc` configure options have been - removed. Use `--with-mongodb-system-libs` instead. - \ No newline at end of file + * The `--with-libbson` and `--with-libmongoc` configure options have been + removed. Use `--with-mongodb-system-libs` instead. + * All classes that previously implemented the `Serializable` interface no + longer implement this interface. diff --git a/src/BSON/Binary.c b/src/BSON/Binary.c index 7560e30dd..4583ac8ab 100644 --- a/src/BSON/Binary.c +++ b/src/BSON/Binary.c @@ -15,9 +15,7 @@ */ #include -#include #include -#include #include #include "php_phongo.h" @@ -184,60 +182,6 @@ static PHP_METHOD(MongoDB_BSON_Binary, jsonSerialize) ADD_ASSOC_STRINGL(return_value, "$type", type, type_len); } -static PHP_METHOD(MongoDB_BSON_Binary, serialize) -{ - php_phongo_binary_t* intern; - zval retval; - php_serialize_data_t var_hash; - smart_str buf = { 0 }; - - intern = Z_BINARY_OBJ_P(getThis()); - - PHONGO_PARSE_PARAMETERS_NONE(); - - array_init_size(&retval, 2); - ADD_ASSOC_STRINGL(&retval, "data", intern->data, intern->data_len); - ADD_ASSOC_LONG_EX(&retval, "type", intern->type); - - PHP_VAR_SERIALIZE_INIT(var_hash); - php_var_serialize(&buf, &retval, &var_hash); - smart_str_0(&buf); - PHP_VAR_SERIALIZE_DESTROY(var_hash); - - PHONGO_RETVAL_SMART_STR(buf); - - smart_str_free(&buf); - zval_ptr_dtor(&retval); -} - -static PHP_METHOD(MongoDB_BSON_Binary, unserialize) -{ - php_phongo_binary_t* intern; - char* serialized; - size_t serialized_len; - zval props; - php_unserialize_data_t var_hash; - - intern = Z_BINARY_OBJ_P(getThis()); - - PHONGO_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STRING(serialized, serialized_len) - PHONGO_PARSE_PARAMETERS_END(); - - PHP_VAR_UNSERIALIZE_INIT(var_hash); - if (!php_var_unserialize(&props, (const unsigned char**) &serialized, (unsigned char*) serialized + serialized_len, &var_hash)) { - zval_ptr_dtor(&props); - phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "%s unserialization failed", ZSTR_VAL(php_phongo_binary_ce->name)); - - PHP_VAR_UNSERIALIZE_DESTROY(var_hash); - return; - } - PHP_VAR_UNSERIALIZE_DESTROY(var_hash); - - php_phongo_binary_init_from_hash(intern, HASH_OF(&props)); - zval_ptr_dtor(&props); -} - static PHP_METHOD(MongoDB_BSON_Binary, __serialize) { PHONGO_PARSE_PARAMETERS_NONE(); @@ -339,7 +283,7 @@ static HashTable* php_phongo_binary_get_properties(zend_object* object) 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, zend_ce_stringable); + 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_stringable); php_phongo_binary_ce->create_object = php_phongo_binary_create_object; memcpy(&php_phongo_handler_binary, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); diff --git a/src/BSON/Binary.stub.php b/src/BSON/Binary.stub.php index a56fbfa42..134fac6c7 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, \Stringable +final class Binary implements BinaryInterface, \JsonSerializable, Type, \Stringable { /** * @var int @@ -79,10 +79,6 @@ final public static function __set_state(array $properties): Binary {} final public function __toString(): string {} - final public function serialize(): string {} - - final public function unserialize(string $data): void {} - final public function __unserialize(array $data): void {} final public function __serialize(): array {} diff --git a/src/BSON/Binary_arginfo.h b/src/BSON/Binary_arginfo.h index d62674965..1363dc09d 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: 5b480f539df83a112ecaecc234364272d9209257 */ + * Stub hash: a08dec3b63e23fbde350360b32fa0323e47069da */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Binary___construct, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0) @@ -18,12 +18,6 @@ ZEND_END_ARG_INFO() #define arginfo_class_MongoDB_BSON_Binary___toString arginfo_class_MongoDB_BSON_Binary_getData -#define arginfo_class_MongoDB_BSON_Binary_serialize arginfo_class_MongoDB_BSON_Binary_getData - -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() - 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) ZEND_END_ARG_INFO() @@ -40,8 +34,6 @@ static ZEND_METHOD(MongoDB_BSON_Binary, getData); 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); -static ZEND_METHOD(MongoDB_BSON_Binary, unserialize); static ZEND_METHOD(MongoDB_BSON_Binary, __unserialize); static ZEND_METHOD(MongoDB_BSON_Binary, __serialize); static ZEND_METHOD(MongoDB_BSON_Binary, jsonSerialize); @@ -53,22 +45,20 @@ static const zend_function_entry class_MongoDB_BSON_Binary_methods[] = { ZEND_ME(MongoDB_BSON_Binary, getType, arginfo_class_MongoDB_BSON_Binary_getType, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) 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) - ZEND_ME(MongoDB_BSON_Binary, unserialize, arginfo_class_MongoDB_BSON_Binary_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) 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) ZEND_ME(MongoDB_BSON_Binary, jsonSerialize, arginfo_class_MongoDB_BSON_Binary_jsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) 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, zend_class_entry *class_entry_Stringable) +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_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, 5, class_entry_MongoDB_BSON_BinaryInterface, class_entry_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable, class_entry_Stringable); + zend_class_implements(class_entry, 4, class_entry_MongoDB_BSON_BinaryInterface, class_entry_JsonSerializable, class_entry_MongoDB_BSON_Type, 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 226abc4e5..b0285732e 100644 --- a/src/BSON/DBPointer.c +++ b/src/BSON/DBPointer.c @@ -17,8 +17,6 @@ #include "bson/bson.h" #include -#include -#include #include #include "php_phongo.h" @@ -147,60 +145,6 @@ static PHP_METHOD(MongoDB_BSON_DBPointer, jsonSerialize) ADD_ASSOC_ZVAL(return_value, "$dbPointer", &zdb_pointer); } -static PHP_METHOD(MongoDB_BSON_DBPointer, serialize) -{ - php_phongo_dbpointer_t* intern; - zval retval; - php_serialize_data_t var_hash; - smart_str buf = { 0 }; - - intern = Z_DBPOINTER_OBJ_P(getThis()); - - PHONGO_PARSE_PARAMETERS_NONE(); - - array_init_size(&retval, 2); - ADD_ASSOC_STRINGL(&retval, "ref", intern->ref, intern->ref_len); - ADD_ASSOC_STRING(&retval, "id", intern->id); - - PHP_VAR_SERIALIZE_INIT(var_hash); - php_var_serialize(&buf, &retval, &var_hash); - smart_str_0(&buf); - PHP_VAR_SERIALIZE_DESTROY(var_hash); - - PHONGO_RETVAL_SMART_STR(buf); - - smart_str_free(&buf); - zval_ptr_dtor(&retval); -} - -static PHP_METHOD(MongoDB_BSON_DBPointer, unserialize) -{ - php_phongo_dbpointer_t* intern; - char* serialized; - size_t serialized_len; - zval props; - php_unserialize_data_t var_hash; - - intern = Z_DBPOINTER_OBJ_P(getThis()); - - PHONGO_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STRING(serialized, serialized_len) - PHONGO_PARSE_PARAMETERS_END(); - - PHP_VAR_UNSERIALIZE_INIT(var_hash); - if (!php_var_unserialize(&props, (const unsigned char**) &serialized, (unsigned char*) serialized + serialized_len, &var_hash)) { - zval_ptr_dtor(&props); - phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "%s unserialization failed", ZSTR_VAL(php_phongo_dbpointer_ce->name)); - - PHP_VAR_UNSERIALIZE_DESTROY(var_hash); - return; - } - PHP_VAR_UNSERIALIZE_DESTROY(var_hash); - - php_phongo_dbpointer_init_from_hash(intern, HASH_OF(&props)); - zval_ptr_dtor(&props); -} - static PHP_METHOD(MongoDB_BSON_DBPointer, __serialize) { PHONGO_PARSE_PARAMETERS_NONE(); @@ -299,7 +243,7 @@ static HashTable* php_phongo_dbpointer_get_properties(zend_object* object) 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, zend_ce_stringable); + php_phongo_dbpointer_ce = register_class_MongoDB_BSON_DBPointer(php_phongo_json_serializable_ce, php_phongo_type_ce, zend_ce_stringable); php_phongo_dbpointer_ce->create_object = php_phongo_dbpointer_create_object; memcpy(&php_phongo_handler_dbpointer, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); diff --git a/src/BSON/DBPointer.stub.php b/src/BSON/DBPointer.stub.php index e88a64805..6c63b2c75 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, \Stringable +final class DBPointer implements \JsonSerializable, Type, \Stringable { final private function __construct() {} @@ -14,10 +14,6 @@ final public static function __set_state(array $properties): DBPointer {} final public function __toString(): string {} - final public function serialize(): string {} - - final public function unserialize(string $data): void {} - final public function __unserialize(array $data): void {} final public function __serialize(): array {} diff --git a/src/BSON/DBPointer_arginfo.h b/src/BSON/DBPointer_arginfo.h index e790aed3b..a1306f87b 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: 0fd301b8c3e14f219023edc4d3137304f2bea022 */ + * Stub hash: 3462cf9349062679b50671a9c388a2a1b2930070 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_DBPointer___construct, 0, 0, 0) ZEND_END_ARG_INFO() @@ -11,12 +11,6 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_DBPointer___toString, 0, 0, IS_STRING, 0) ZEND_END_ARG_INFO() -#define arginfo_class_MongoDB_BSON_DBPointer_serialize arginfo_class_MongoDB_BSON_DBPointer___toString - -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() - 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) ZEND_END_ARG_INFO() @@ -31,8 +25,6 @@ ZEND_END_ARG_INFO() 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); -static ZEND_METHOD(MongoDB_BSON_DBPointer, unserialize); static ZEND_METHOD(MongoDB_BSON_DBPointer, __unserialize); static ZEND_METHOD(MongoDB_BSON_DBPointer, __serialize); static ZEND_METHOD(MongoDB_BSON_DBPointer, jsonSerialize); @@ -42,22 +34,20 @@ static const zend_function_entry class_MongoDB_BSON_DBPointer_methods[] = { ZEND_ME(MongoDB_BSON_DBPointer, __construct, arginfo_class_MongoDB_BSON_DBPointer___construct, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL) 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) - ZEND_ME(MongoDB_BSON_DBPointer, unserialize, arginfo_class_MongoDB_BSON_DBPointer_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) 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) ZEND_ME(MongoDB_BSON_DBPointer, jsonSerialize, arginfo_class_MongoDB_BSON_DBPointer_jsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) 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, zend_class_entry *class_entry_Stringable) +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_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, 4, class_entry_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable, class_entry_Stringable); + zend_class_implements(class_entry, 3, class_entry_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Stringable); return class_entry; } diff --git a/src/BSON/Decimal128.c b/src/BSON/Decimal128.c index 3ef35cf05..970ee00e7 100644 --- a/src/BSON/Decimal128.c +++ b/src/BSON/Decimal128.c @@ -17,8 +17,6 @@ #include "bson/bson.h" #include -#include -#include #include #include "php_phongo.h" @@ -143,61 +141,6 @@ static PHP_METHOD(MongoDB_BSON_Decimal128, jsonSerialize) ADD_ASSOC_STRING(return_value, "$numberDecimal", outbuf); } -static PHP_METHOD(MongoDB_BSON_Decimal128, serialize) -{ - php_phongo_decimal128_t* intern; - zval retval; - php_serialize_data_t var_hash; - smart_str buf = { 0 }; - char outbuf[BSON_DECIMAL128_STRING]; - - intern = Z_DECIMAL128_OBJ_P(getThis()); - - PHONGO_PARSE_PARAMETERS_NONE(); - - bson_decimal128_to_string(&intern->decimal, outbuf); - array_init_size(&retval, 1); - ADD_ASSOC_STRING(&retval, "dec", outbuf); - - PHP_VAR_SERIALIZE_INIT(var_hash); - php_var_serialize(&buf, &retval, &var_hash); - smart_str_0(&buf); - PHP_VAR_SERIALIZE_DESTROY(var_hash); - - PHONGO_RETVAL_SMART_STR(buf); - - smart_str_free(&buf); - zval_ptr_dtor(&retval); -} - -static PHP_METHOD(MongoDB_BSON_Decimal128, unserialize) -{ - php_phongo_decimal128_t* intern; - char* serialized; - size_t serialized_len; - zval props; - php_unserialize_data_t var_hash; - - intern = Z_DECIMAL128_OBJ_P(getThis()); - - PHONGO_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STRING(serialized, serialized_len) - PHONGO_PARSE_PARAMETERS_END(); - - PHP_VAR_UNSERIALIZE_INIT(var_hash); - if (!php_var_unserialize(&props, (const unsigned char**) &serialized, (unsigned char*) serialized + serialized_len, &var_hash)) { - zval_ptr_dtor(&props); - phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "%s unserialization failed", ZSTR_VAL(php_phongo_decimal128_ce->name)); - - PHP_VAR_UNSERIALIZE_DESTROY(var_hash); - return; - } - PHP_VAR_UNSERIALIZE_DESTROY(var_hash); - - php_phongo_decimal128_init_from_hash(intern, HASH_OF(&props)); - zval_ptr_dtor(&props); -} - static PHP_METHOD(MongoDB_BSON_Decimal128, __serialize) { PHONGO_PARSE_PARAMETERS_NONE(); @@ -275,7 +218,7 @@ static HashTable* php_phongo_decimal128_get_properties(zend_object* object) 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, zend_ce_stringable); + 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_stringable); php_phongo_decimal128_ce->create_object = php_phongo_decimal128_create_object; memcpy(&php_phongo_handler_decimal128, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); diff --git a/src/BSON/Decimal128.stub.php b/src/BSON/Decimal128.stub.php index 27e563ad9..be677f00a 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, \Stringable +final class Decimal128 implements Decimal128Interface, \JsonSerializable, Type, \Stringable { final public function __construct(string $value) {} @@ -15,10 +15,6 @@ final public function __toString(): string {} final public static function __set_state(array $properties): Decimal128 {} - final public function serialize(): string {} - - final public function unserialize(string $data): void {} - final public function __unserialize(array $data): void {} final public function __serialize(): array {} diff --git a/src/BSON/Decimal128_arginfo.h b/src/BSON/Decimal128_arginfo.h index a78badcfd..33775737d 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: e2a5c43ff506b05c576242ab76ea1cb7fd9f5c30 */ + * Stub hash: 93e233be4ba07472af49fe8b8d3278ec30c570a9 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Decimal128___construct, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0) @@ -12,12 +12,6 @@ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_BSON_Decimal128___s ZEND_ARG_TYPE_INFO(0, properties, IS_ARRAY, 0) ZEND_END_ARG_INFO() -#define arginfo_class_MongoDB_BSON_Decimal128_serialize arginfo_class_MongoDB_BSON_Decimal128___toString - -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() - 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) ZEND_END_ARG_INFO() @@ -32,8 +26,6 @@ ZEND_END_ARG_INFO() 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); -static ZEND_METHOD(MongoDB_BSON_Decimal128, unserialize); static ZEND_METHOD(MongoDB_BSON_Decimal128, __unserialize); static ZEND_METHOD(MongoDB_BSON_Decimal128, __serialize); static ZEND_METHOD(MongoDB_BSON_Decimal128, jsonSerialize); @@ -43,22 +35,20 @@ static const zend_function_entry class_MongoDB_BSON_Decimal128_methods[] = { ZEND_ME(MongoDB_BSON_Decimal128, __construct, arginfo_class_MongoDB_BSON_Decimal128___construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) 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) - ZEND_ME(MongoDB_BSON_Decimal128, unserialize, arginfo_class_MongoDB_BSON_Decimal128_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) 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) ZEND_ME(MongoDB_BSON_Decimal128, jsonSerialize, arginfo_class_MongoDB_BSON_Decimal128_jsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) 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, zend_class_entry *class_entry_Stringable) +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_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, 5, class_entry_MongoDB_BSON_Decimal128Interface, class_entry_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable, class_entry_Stringable); + zend_class_implements(class_entry, 4, class_entry_MongoDB_BSON_Decimal128Interface, class_entry_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Stringable); return class_entry; } diff --git a/src/BSON/Document.c b/src/BSON/Document.c index 92e83ab73..d82ca20b4 100644 --- a/src/BSON/Document.c +++ b/src/BSON/Document.c @@ -16,11 +16,8 @@ #include #include -#include #include #include -#include -#include #ifdef HAVE_CONFIG_H #include "config.h" @@ -375,62 +372,6 @@ static PHP_METHOD(MongoDB_BSON_Document, __set_state) php_phongo_document_init_from_hash(intern, props); } -static PHP_METHOD(MongoDB_BSON_Document, serialize) -{ - php_phongo_document_t* intern; - zval retval; - php_serialize_data_t var_hash; - smart_str buf = { 0 }; - zend_string* str; - - intern = Z_DOCUMENT_OBJ_P(getThis()); - - PHONGO_PARSE_PARAMETERS_NONE(); - - array_init_size(&retval, 1); - str = php_base64_encode(bson_get_data(intern->bson), intern->bson->len); - ADD_ASSOC_STR(&retval, "data", str); - - PHP_VAR_SERIALIZE_INIT(var_hash); - php_var_serialize(&buf, &retval, &var_hash); - smart_str_0(&buf); - PHP_VAR_SERIALIZE_DESTROY(var_hash); - - PHONGO_RETVAL_SMART_STR(buf); - - zend_string_free(str); - smart_str_free(&buf); - zval_ptr_dtor(&retval); -} - -static PHP_METHOD(MongoDB_BSON_Document, unserialize) -{ - php_phongo_document_t* intern; - char* serialized; - size_t serialized_len; - zval props; - php_unserialize_data_t var_hash; - - intern = Z_DOCUMENT_OBJ_P(getThis()); - - PHONGO_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STRING(serialized, serialized_len) - PHONGO_PARSE_PARAMETERS_END(); - - PHP_VAR_UNSERIALIZE_INIT(var_hash); - if (!php_var_unserialize(&props, (const unsigned char**) &serialized, (unsigned char*) serialized + serialized_len, &var_hash)) { - zval_ptr_dtor(&props); - phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "%s unserialization failed", ZSTR_VAL(php_phongo_document_ce->name)); - - PHP_VAR_UNSERIALIZE_DESTROY(var_hash); - return; - } - PHP_VAR_UNSERIALIZE_DESTROY(var_hash); - - php_phongo_document_init_from_hash(intern, HASH_OF(&props)); - zval_ptr_dtor(&props); -} - static PHP_METHOD(MongoDB_BSON_Document, __serialize) { PHONGO_PARSE_PARAMETERS_NONE(); @@ -635,7 +576,7 @@ void php_phongo_document_unset_dimension(zend_object* object, zval* offset) 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, zend_ce_stringable); + php_phongo_document_ce = register_class_MongoDB_BSON_Document(zend_ce_aggregate, zend_ce_arrayaccess, php_phongo_type_ce, zend_ce_stringable); php_phongo_document_ce->create_object = php_phongo_document_create_object; memcpy(&php_phongo_handler_document, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); diff --git a/src/BSON/Document.stub.php b/src/BSON/Document.stub.php index 5e5c8250a..ba0cd87e4 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, \Stringable +final class Document implements \IteratorAggregate, \ArrayAccess, Type, \Stringable { private function __construct() {} @@ -41,10 +41,6 @@ final public function __toString(): string {} final public static function __set_state(array $properties): Document {} - final public function serialize(): string {} - - final public function unserialize(string $data): void {} - final public function __unserialize(array $data): void {} final public function __serialize(): array {} diff --git a/src/BSON/Document_arginfo.h b/src/BSON/Document_arginfo.h index 955ea571a..39c047638 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: 4efc86c2e070f6d6a8dd5cbfe6ea126fba9a4251 */ + * Stub hash: 13d114590a7c0bc86da4dbb1383d17c296edcb40 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Document___construct, 0, 0, 0) ZEND_END_ARG_INFO() @@ -59,12 +59,6 @@ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_BSON_Document___set ZEND_ARG_TYPE_INFO(0, properties, IS_ARRAY, 0) ZEND_END_ARG_INFO() -#define arginfo_class_MongoDB_BSON_Document_serialize arginfo_class_MongoDB_BSON_Document_toCanonicalExtendedJSON - -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() - 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) ZEND_END_ARG_INFO() @@ -89,8 +83,6 @@ static ZEND_METHOD(MongoDB_BSON_Document, offsetSet); static ZEND_METHOD(MongoDB_BSON_Document, offsetUnset); static ZEND_METHOD(MongoDB_BSON_Document, __toString); static ZEND_METHOD(MongoDB_BSON_Document, __set_state); -static ZEND_METHOD(MongoDB_BSON_Document, serialize); -static ZEND_METHOD(MongoDB_BSON_Document, unserialize); static ZEND_METHOD(MongoDB_BSON_Document, __unserialize); static ZEND_METHOD(MongoDB_BSON_Document, __serialize); @@ -112,21 +104,19 @@ static const zend_function_entry class_MongoDB_BSON_Document_methods[] = { ZEND_ME(MongoDB_BSON_Document, offsetUnset, arginfo_class_MongoDB_BSON_Document_offsetUnset, ZEND_ACC_PUBLIC) 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) - ZEND_ME(MongoDB_BSON_Document, unserialize, arginfo_class_MongoDB_BSON_Document_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) 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, zend_class_entry *class_entry_Stringable) +static zend_class_entry *register_class_MongoDB_BSON_Document(zend_class_entry *class_entry_IteratorAggregate, 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, 5, class_entry_IteratorAggregate, class_entry_Serializable, class_entry_ArrayAccess, class_entry_MongoDB_BSON_Type, class_entry_Stringable); + zend_class_implements(class_entry, 4, class_entry_IteratorAggregate, 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 dae06bc7c..f92005573 100644 --- a/src/BSON/Int64.c +++ b/src/BSON/Int64.c @@ -15,8 +15,6 @@ */ #include -#include -#include #include #include @@ -150,59 +148,6 @@ static PHP_METHOD(MongoDB_BSON_Int64, jsonSerialize) ADD_ASSOC_INT64_AS_STRING(return_value, "$numberLong", intern->integer); } -static PHP_METHOD(MongoDB_BSON_Int64, serialize) -{ - php_phongo_int64_t* intern; - zval retval; - php_serialize_data_t var_hash; - smart_str buf = { 0 }; - - PHONGO_PARSE_PARAMETERS_NONE(); - - intern = Z_INT64_OBJ_P(getThis()); - - array_init_size(&retval, 1); - ADD_ASSOC_INT64_AS_STRING(&retval, "integer", intern->integer); - - PHP_VAR_SERIALIZE_INIT(var_hash); - php_var_serialize(&buf, &retval, &var_hash); - smart_str_0(&buf); - PHP_VAR_SERIALIZE_DESTROY(var_hash); - - PHONGO_RETVAL_SMART_STR(buf); - - smart_str_free(&buf); - zval_ptr_dtor(&retval); -} - -static PHP_METHOD(MongoDB_BSON_Int64, unserialize) -{ - php_phongo_int64_t* intern; - char* serialized; - size_t serialized_len; - zval props; - php_unserialize_data_t var_hash; - - intern = Z_INT64_OBJ_P(getThis()); - - PHONGO_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STRING(serialized, serialized_len) - PHONGO_PARSE_PARAMETERS_END(); - - PHP_VAR_UNSERIALIZE_INIT(var_hash); - if (!php_var_unserialize(&props, (const unsigned char**) &serialized, (unsigned char*) serialized + serialized_len, &var_hash)) { - zval_ptr_dtor(&props); - phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "%s unserialization failed", ZSTR_VAL(php_phongo_int64_ce->name)); - - PHP_VAR_UNSERIALIZE_DESTROY(var_hash); - return; - } - PHP_VAR_UNSERIALIZE_DESTROY(var_hash); - - php_phongo_int64_init_from_hash(intern, HASH_OF(&props)); - zval_ptr_dtor(&props); -} - static PHP_METHOD(MongoDB_BSON_Int64, __serialize) { PHONGO_PARSE_PARAMETERS_NONE(); @@ -611,7 +556,7 @@ static HashTable* php_phongo_int64_get_properties(zend_object* object) 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, zend_ce_stringable); + php_phongo_int64_ce = register_class_MongoDB_BSON_Int64(php_phongo_json_serializable_ce, php_phongo_type_ce, zend_ce_stringable); php_phongo_int64_ce->create_object = php_phongo_int64_create_object; memcpy(&php_phongo_handler_int64, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); diff --git a/src/BSON/Int64.stub.php b/src/BSON/Int64.stub.php index 4e22256c5..f56cd6f26 100644 --- a/src/BSON/Int64.stub.php +++ b/src/BSON/Int64.stub.php @@ -7,7 +7,7 @@ namespace MongoDB\BSON; -final class Int64 implements \JsonSerializable, Type, \Serializable, \Stringable +final class Int64 implements \JsonSerializable, Type, \Stringable { final public function __construct(int|string $value) {} @@ -15,10 +15,6 @@ final public function __toString(): string {} final public static function __set_state(array $properties): Int64 {} - final public function serialize(): string {} - - final public function unserialize(string $data): void {} - final public function __unserialize(array $data): void {} final public function __serialize(): array {} diff --git a/src/BSON/Int64_arginfo.h b/src/BSON/Int64_arginfo.h index 27f4c7708..99d1a88ee 100644 --- a/src/BSON/Int64_arginfo.h +++ b/src/BSON/Int64_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 26a7fdee9a7adefd7d6877669d4d28b9c68d8153 */ + * Stub hash: ecb9f0dd09b4af79334ef03ac2a5e04f111ab7b3 */ 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) @@ -12,12 +12,6 @@ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_BSON_Int64___set_st ZEND_ARG_TYPE_INFO(0, properties, IS_ARRAY, 0) ZEND_END_ARG_INFO() -#define arginfo_class_MongoDB_BSON_Int64_serialize arginfo_class_MongoDB_BSON_Int64___toString - -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() - 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) ZEND_END_ARG_INFO() @@ -32,8 +26,6 @@ ZEND_END_ARG_INFO() static ZEND_METHOD(MongoDB_BSON_Int64, __construct); static ZEND_METHOD(MongoDB_BSON_Int64, __toString); static ZEND_METHOD(MongoDB_BSON_Int64, __set_state); -static ZEND_METHOD(MongoDB_BSON_Int64, serialize); -static ZEND_METHOD(MongoDB_BSON_Int64, unserialize); static ZEND_METHOD(MongoDB_BSON_Int64, __unserialize); static ZEND_METHOD(MongoDB_BSON_Int64, __serialize); static ZEND_METHOD(MongoDB_BSON_Int64, jsonSerialize); @@ -43,22 +35,20 @@ static const zend_function_entry class_MongoDB_BSON_Int64_methods[] = { ZEND_ME(MongoDB_BSON_Int64, __construct, arginfo_class_MongoDB_BSON_Int64___construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) 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) - ZEND_ME(MongoDB_BSON_Int64, unserialize, arginfo_class_MongoDB_BSON_Int64_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) 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) ZEND_ME(MongoDB_BSON_Int64, jsonSerialize, arginfo_class_MongoDB_BSON_Int64_jsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) 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, zend_class_entry *class_entry_Stringable) +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_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, 4, class_entry_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable, class_entry_Stringable); + zend_class_implements(class_entry, 3, class_entry_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Stringable); return class_entry; } diff --git a/src/BSON/Javascript.c b/src/BSON/Javascript.c index 9dbd5b8b7..38312dc2d 100644 --- a/src/BSON/Javascript.c +++ b/src/BSON/Javascript.c @@ -17,8 +17,6 @@ #include "bson/bson.h" #include -#include -#include #include #include "php_phongo.h" @@ -229,72 +227,6 @@ static PHP_METHOD(MongoDB_BSON_Javascript, jsonSerialize) } } -static PHP_METHOD(MongoDB_BSON_Javascript, serialize) -{ - php_phongo_javascript_t* intern; - zval retval; - php_phongo_bson_state state; - php_serialize_data_t var_hash; - smart_str buf = { 0 }; - - PHONGO_BSON_INIT_STATE(state); - - intern = Z_JAVASCRIPT_OBJ_P(getThis()); - - PHONGO_PARSE_PARAMETERS_NONE(); - - if (intern->scope && intern->scope->len) { - if (!php_phongo_bson_to_zval_ex(intern->scope, &state)) { - zval_ptr_dtor(&state.zchild); - return; - } - } else { - ZVAL_NULL(&state.zchild); - } - - array_init_size(&retval, 2); - ADD_ASSOC_STRINGL(&retval, "code", intern->code, intern->code_len); - ADD_ASSOC_ZVAL(&retval, "scope", &state.zchild); - - PHP_VAR_SERIALIZE_INIT(var_hash); - php_var_serialize(&buf, &retval, &var_hash); - smart_str_0(&buf); - PHP_VAR_SERIALIZE_DESTROY(var_hash); - - PHONGO_RETVAL_SMART_STR(buf); - - smart_str_free(&buf); - zval_ptr_dtor(&retval); -} - -static PHP_METHOD(MongoDB_BSON_Javascript, unserialize) -{ - php_phongo_javascript_t* intern; - char* serialized; - size_t serialized_len; - zval props; - php_unserialize_data_t var_hash; - - intern = Z_JAVASCRIPT_OBJ_P(getThis()); - - PHONGO_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STRING(serialized, serialized_len) - PHONGO_PARSE_PARAMETERS_END(); - - PHP_VAR_UNSERIALIZE_INIT(var_hash); - if (!php_var_unserialize(&props, (const unsigned char**) &serialized, (unsigned char*) serialized + serialized_len, &var_hash)) { - zval_ptr_dtor(&props); - phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "%s unserialization failed", ZSTR_VAL(php_phongo_javascript_ce->name)); - - PHP_VAR_UNSERIALIZE_DESTROY(var_hash); - return; - } - PHP_VAR_UNSERIALIZE_DESTROY(var_hash); - - php_phongo_javascript_init_from_hash(intern, HASH_OF(&props)); - zval_ptr_dtor(&props); -} - static PHP_METHOD(MongoDB_BSON_Javascript, __serialize) { PHONGO_PARSE_PARAMETERS_NONE(); @@ -392,7 +324,7 @@ static HashTable* php_phongo_javascript_get_properties(zend_object* object) 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, zend_ce_stringable); + 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_stringable); php_phongo_javascript_ce->create_object = php_phongo_javascript_create_object; memcpy(&php_phongo_handler_javascript, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); diff --git a/src/BSON/Javascript.stub.php b/src/BSON/Javascript.stub.php index 90b358eba..3ac402108 100644 --- a/src/BSON/Javascript.stub.php +++ b/src/BSON/Javascript.stub.php @@ -7,7 +7,7 @@ namespace MongoDB\BSON; -final class Javascript implements JavascriptInterface, \JsonSerializable, Type, \Serializable, \Stringable +final class Javascript implements JavascriptInterface, \JsonSerializable, Type, \Stringable { final public function __construct(string $code, array|object|null $scope = null) {} @@ -19,10 +19,6 @@ final public function getScope(): ?object {} final public function __toString(): string {} - final public function serialize(): string {} - - final public function unserialize(string $data): void {} - final public function __unserialize(array $data): void {} final public function __serialize(): array {} diff --git a/src/BSON/Javascript_arginfo.h b/src/BSON/Javascript_arginfo.h index e14f8747d..128ff6b21 100644 --- a/src/BSON/Javascript_arginfo.h +++ b/src/BSON/Javascript_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: ca211f93a2f8cb801527ed7a3f4b6c434d879370 */ + * Stub hash: 017421710f18d98547b7f987309bcd932a076245 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Javascript___construct, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, code, IS_STRING, 0) @@ -18,12 +18,6 @@ ZEND_END_ARG_INFO() #define arginfo_class_MongoDB_BSON_Javascript___toString arginfo_class_MongoDB_BSON_Javascript_getCode -#define arginfo_class_MongoDB_BSON_Javascript_serialize arginfo_class_MongoDB_BSON_Javascript_getCode - -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() - 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) ZEND_END_ARG_INFO() @@ -40,8 +34,6 @@ 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); -static ZEND_METHOD(MongoDB_BSON_Javascript, unserialize); static ZEND_METHOD(MongoDB_BSON_Javascript, __unserialize); static ZEND_METHOD(MongoDB_BSON_Javascript, __serialize); static ZEND_METHOD(MongoDB_BSON_Javascript, jsonSerialize); @@ -53,22 +45,20 @@ static const zend_function_entry class_MongoDB_BSON_Javascript_methods[] = { 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) - ZEND_ME(MongoDB_BSON_Javascript, unserialize, arginfo_class_MongoDB_BSON_Javascript_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) 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) ZEND_ME(MongoDB_BSON_Javascript, jsonSerialize, arginfo_class_MongoDB_BSON_Javascript_jsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) 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, zend_class_entry *class_entry_Stringable) +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_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, 5, class_entry_MongoDB_BSON_JavascriptInterface, class_entry_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable, class_entry_Stringable); + zend_class_implements(class_entry, 4, class_entry_MongoDB_BSON_JavascriptInterface, class_entry_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Stringable); return class_entry; } diff --git a/src/BSON/MaxKey.c b/src/BSON/MaxKey.c index 3a747ea00..3010b567e 100644 --- a/src/BSON/MaxKey.c +++ b/src/BSON/MaxKey.c @@ -15,8 +15,6 @@ */ #include -#include -#include #include #include "php_phongo.h" @@ -44,23 +42,6 @@ static PHP_METHOD(MongoDB_BSON_MaxKey, jsonSerialize) ADD_ASSOC_LONG_EX(return_value, "$maxKey", 1); } -static PHP_METHOD(MongoDB_BSON_MaxKey, serialize) -{ - PHONGO_PARSE_PARAMETERS_NONE(); - - RETURN_STRING(""); -} - -static PHP_METHOD(MongoDB_BSON_MaxKey, unserialize) -{ - char* serialized; - size_t serialized_len; - - PHONGO_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STRING(serialized, serialized_len) - PHONGO_PARSE_PARAMETERS_END(); -} - static PHP_METHOD(MongoDB_BSON_MaxKey, __serialize) { PHONGO_PARSE_PARAMETERS_NONE(); @@ -101,7 +82,7 @@ static zend_object* php_phongo_maxkey_create_object(zend_class_entry* class_type void php_phongo_maxkey_init_ce(INIT_FUNC_ARGS) { - php_phongo_maxkey_ce = register_class_MongoDB_BSON_MaxKey(php_phongo_maxkey_interface_ce, php_phongo_json_serializable_ce, php_phongo_type_ce, zend_ce_serializable); + php_phongo_maxkey_ce = register_class_MongoDB_BSON_MaxKey(php_phongo_maxkey_interface_ce, php_phongo_json_serializable_ce, php_phongo_type_ce); php_phongo_maxkey_ce->create_object = php_phongo_maxkey_create_object; memcpy(&php_phongo_handler_maxkey, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); diff --git a/src/BSON/MaxKey.stub.php b/src/BSON/MaxKey.stub.php index 95875b8c9..cbcc6eb4b 100644 --- a/src/BSON/MaxKey.stub.php +++ b/src/BSON/MaxKey.stub.php @@ -7,14 +7,10 @@ namespace MongoDB\BSON; -final class MaxKey implements MaxKeyInterface, \JsonSerializable, Type, \Serializable +final class MaxKey implements MaxKeyInterface, \JsonSerializable, Type { final public static function __set_state(array $properties): MaxKey {} - final public function serialize(): string {} - - final public function unserialize(string $data): void {} - final public function __unserialize(array $data): void {} final public function __serialize(): array {} diff --git a/src/BSON/MaxKey_arginfo.h b/src/BSON/MaxKey_arginfo.h index 0b9667c66..0de019b5d 100644 --- a/src/BSON/MaxKey_arginfo.h +++ b/src/BSON/MaxKey_arginfo.h @@ -1,17 +1,10 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: d397817e708c2633223aa7b6a7273c0a1a4feb1d */ + * Stub hash: df810b4d4876637e555a0e129e940acc5177b892 */ 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) 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() - -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() - 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) ZEND_END_ARG_INFO() @@ -24,8 +17,6 @@ ZEND_END_ARG_INFO() static ZEND_METHOD(MongoDB_BSON_MaxKey, __set_state); -static ZEND_METHOD(MongoDB_BSON_MaxKey, serialize); -static ZEND_METHOD(MongoDB_BSON_MaxKey, unserialize); static ZEND_METHOD(MongoDB_BSON_MaxKey, __unserialize); static ZEND_METHOD(MongoDB_BSON_MaxKey, __serialize); static ZEND_METHOD(MongoDB_BSON_MaxKey, jsonSerialize); @@ -33,22 +24,20 @@ static ZEND_METHOD(MongoDB_BSON_MaxKey, jsonSerialize); 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) - ZEND_ME(MongoDB_BSON_MaxKey, unserialize, arginfo_class_MongoDB_BSON_MaxKey_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) 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) ZEND_ME(MongoDB_BSON_MaxKey, jsonSerialize, arginfo_class_MongoDB_BSON_MaxKey_jsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_FE_END }; -static zend_class_entry *register_class_MongoDB_BSON_MaxKey(zend_class_entry *class_entry_MongoDB_BSON_MaxKeyInterface, 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_MaxKey(zend_class_entry *class_entry_MongoDB_BSON_MaxKeyInterface, zend_class_entry *class_entry_JsonSerializable, zend_class_entry *class_entry_MongoDB_BSON_Type) { zend_class_entry ce, *class_entry; INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "MaxKey", class_MongoDB_BSON_MaxKey_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_MaxKeyInterface, class_entry_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable); + zend_class_implements(class_entry, 3, class_entry_MongoDB_BSON_MaxKeyInterface, class_entry_JsonSerializable, class_entry_MongoDB_BSON_Type); return class_entry; } diff --git a/src/BSON/MinKey.c b/src/BSON/MinKey.c index 773506450..9884999dd 100644 --- a/src/BSON/MinKey.c +++ b/src/BSON/MinKey.c @@ -15,8 +15,6 @@ */ #include -#include -#include #include #include "php_phongo.h" @@ -44,23 +42,6 @@ static PHP_METHOD(MongoDB_BSON_MinKey, jsonSerialize) ADD_ASSOC_LONG_EX(return_value, "$minKey", 1); } -static PHP_METHOD(MongoDB_BSON_MinKey, serialize) -{ - PHONGO_PARSE_PARAMETERS_NONE(); - - RETURN_STRING(""); -} - -static PHP_METHOD(MongoDB_BSON_MinKey, unserialize) -{ - char* serialized; - size_t serialized_len; - - PHONGO_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STRING(serialized, serialized_len) - PHONGO_PARSE_PARAMETERS_END(); -} - static PHP_METHOD(MongoDB_BSON_MinKey, __serialize) { PHONGO_PARSE_PARAMETERS_NONE(); @@ -101,7 +82,7 @@ static zend_object* php_phongo_minkey_create_object(zend_class_entry* class_type void php_phongo_minkey_init_ce(INIT_FUNC_ARGS) { - php_phongo_minkey_ce = register_class_MongoDB_BSON_MinKey(php_phongo_minkey_interface_ce, php_phongo_json_serializable_ce, php_phongo_type_ce, zend_ce_serializable); + php_phongo_minkey_ce = register_class_MongoDB_BSON_MinKey(php_phongo_minkey_interface_ce, php_phongo_json_serializable_ce, php_phongo_type_ce); php_phongo_minkey_ce->create_object = php_phongo_minkey_create_object; memcpy(&php_phongo_handler_minkey, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); diff --git a/src/BSON/MinKey.stub.php b/src/BSON/MinKey.stub.php index e12122706..0efd116c4 100644 --- a/src/BSON/MinKey.stub.php +++ b/src/BSON/MinKey.stub.php @@ -7,14 +7,10 @@ namespace MongoDB\BSON; -final class MinKey implements MinKeyInterface, \JsonSerializable, Type, \Serializable +final class MinKey implements MinKeyInterface, \JsonSerializable, Type { final public static function __set_state(array $properties): MinKey {} - final public function serialize(): string {} - - final public function unserialize(string $data): void {} - final public function __unserialize(array $data): void {} final public function __serialize(): array {} diff --git a/src/BSON/MinKey_arginfo.h b/src/BSON/MinKey_arginfo.h index c3aef6ac0..3a58f24a0 100644 --- a/src/BSON/MinKey_arginfo.h +++ b/src/BSON/MinKey_arginfo.h @@ -1,17 +1,10 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: faf0e180715b7673158c3230cc109a93124cf4a9 */ + * Stub hash: 75a01ebbfa05e7a9b38aa1bd1a0bef3e0a06637e */ 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) 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() - -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() - 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) ZEND_END_ARG_INFO() @@ -24,8 +17,6 @@ ZEND_END_ARG_INFO() static ZEND_METHOD(MongoDB_BSON_MinKey, __set_state); -static ZEND_METHOD(MongoDB_BSON_MinKey, serialize); -static ZEND_METHOD(MongoDB_BSON_MinKey, unserialize); static ZEND_METHOD(MongoDB_BSON_MinKey, __unserialize); static ZEND_METHOD(MongoDB_BSON_MinKey, __serialize); static ZEND_METHOD(MongoDB_BSON_MinKey, jsonSerialize); @@ -33,22 +24,20 @@ static ZEND_METHOD(MongoDB_BSON_MinKey, jsonSerialize); 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) - ZEND_ME(MongoDB_BSON_MinKey, unserialize, arginfo_class_MongoDB_BSON_MinKey_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) 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) ZEND_ME(MongoDB_BSON_MinKey, jsonSerialize, arginfo_class_MongoDB_BSON_MinKey_jsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_FE_END }; -static zend_class_entry *register_class_MongoDB_BSON_MinKey(zend_class_entry *class_entry_MongoDB_BSON_MinKeyInterface, 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_MinKey(zend_class_entry *class_entry_MongoDB_BSON_MinKeyInterface, zend_class_entry *class_entry_JsonSerializable, zend_class_entry *class_entry_MongoDB_BSON_Type) { zend_class_entry ce, *class_entry; INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "MinKey", class_MongoDB_BSON_MinKey_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_MinKeyInterface, class_entry_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable); + zend_class_implements(class_entry, 3, class_entry_MongoDB_BSON_MinKeyInterface, class_entry_JsonSerializable, class_entry_MongoDB_BSON_Type); return class_entry; } diff --git a/src/BSON/ObjectId.c b/src/BSON/ObjectId.c index cca84e832..240441ac4 100644 --- a/src/BSON/ObjectId.c +++ b/src/BSON/ObjectId.c @@ -17,8 +17,6 @@ #include "bson/bson.h" #include -#include -#include #include #include "php_phongo.h" @@ -177,59 +175,6 @@ static PHP_METHOD(MongoDB_BSON_ObjectId, jsonSerialize) ADD_ASSOC_STRINGL(return_value, "$oid", intern->oid, PHONGO_OID_LEN); } -static PHP_METHOD(MongoDB_BSON_ObjectId, serialize) -{ - php_phongo_objectid_t* intern; - zval retval; - php_serialize_data_t var_hash; - smart_str buf = { 0 }; - - intern = Z_OBJECTID_OBJ_P(getThis()); - - PHONGO_PARSE_PARAMETERS_NONE(); - - array_init_size(&retval, 1); - ADD_ASSOC_STRINGL(&retval, "oid", intern->oid, PHONGO_OID_LEN); - - PHP_VAR_SERIALIZE_INIT(var_hash); - php_var_serialize(&buf, &retval, &var_hash); - smart_str_0(&buf); - PHP_VAR_SERIALIZE_DESTROY(var_hash); - - PHONGO_RETVAL_SMART_STR(buf); - - smart_str_free(&buf); - zval_ptr_dtor(&retval); -} - -static PHP_METHOD(MongoDB_BSON_ObjectId, unserialize) -{ - php_phongo_objectid_t* intern; - char* serialized; - size_t serialized_len; - zval props; - php_unserialize_data_t var_hash; - - intern = Z_OBJECTID_OBJ_P(getThis()); - - PHONGO_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STRING(serialized, serialized_len) - PHONGO_PARSE_PARAMETERS_END(); - - PHP_VAR_UNSERIALIZE_INIT(var_hash); - if (!php_var_unserialize(&props, (const unsigned char**) &serialized, (unsigned char*) serialized + serialized_len, &var_hash)) { - zval_ptr_dtor(&props); - phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "%s unserialization failed", ZSTR_VAL(php_phongo_objectid_ce->name)); - - PHP_VAR_UNSERIALIZE_DESTROY(var_hash); - return; - } - PHP_VAR_UNSERIALIZE_DESTROY(var_hash); - - php_phongo_objectid_init_from_hash(intern, HASH_OF(&props)); - zval_ptr_dtor(&props); -} - static PHP_METHOD(MongoDB_BSON_ObjectId, __serialize) { PHONGO_PARSE_PARAMETERS_NONE(); @@ -320,7 +265,7 @@ static HashTable* php_phongo_objectid_get_properties(zend_object* object) 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, zend_ce_stringable); + 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_stringable); php_phongo_objectid_ce->create_object = php_phongo_objectid_create_object; memcpy(&php_phongo_handler_objectid, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); diff --git a/src/BSON/ObjectId.stub.php b/src/BSON/ObjectId.stub.php index 1b873c5e0..523649afe 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, \Stringable +final class ObjectId implements ObjectIdInterface, \JsonSerializable, Type, \Stringable { final public function __construct(?string $id = null) {} @@ -17,10 +17,6 @@ final public function __toString(): string {} final public static function __set_state(array $properties): ObjectId {} - final public function serialize(): string {} - - final public function unserialize(string $data): void {} - final public function __unserialize(array $data): void {} final public function __serialize(): array {} diff --git a/src/BSON/ObjectId_arginfo.h b/src/BSON/ObjectId_arginfo.h index a4184611e..67f61eff5 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: 22bff62df5f5363fbb44eabf77225e1b765be73f */ + * Stub hash: beb5fbef79a5e5c826c086ffbf912748dd15f19b */ 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") @@ -15,12 +15,6 @@ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_BSON_ObjectId___set ZEND_ARG_TYPE_INFO(0, properties, IS_ARRAY, 0) ZEND_END_ARG_INFO() -#define arginfo_class_MongoDB_BSON_ObjectId_serialize arginfo_class_MongoDB_BSON_ObjectId___toString - -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() - 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) ZEND_END_ARG_INFO() @@ -36,8 +30,6 @@ static ZEND_METHOD(MongoDB_BSON_ObjectId, __construct); 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); -static ZEND_METHOD(MongoDB_BSON_ObjectId, unserialize); static ZEND_METHOD(MongoDB_BSON_ObjectId, __unserialize); static ZEND_METHOD(MongoDB_BSON_ObjectId, __serialize); static ZEND_METHOD(MongoDB_BSON_ObjectId, jsonSerialize); @@ -48,22 +40,20 @@ static const zend_function_entry class_MongoDB_BSON_ObjectId_methods[] = { ZEND_ME(MongoDB_BSON_ObjectId, getTimestamp, arginfo_class_MongoDB_BSON_ObjectId_getTimestamp, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) 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) - ZEND_ME(MongoDB_BSON_ObjectId, unserialize, arginfo_class_MongoDB_BSON_ObjectId_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) 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) ZEND_ME(MongoDB_BSON_ObjectId, jsonSerialize, arginfo_class_MongoDB_BSON_ObjectId_jsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) 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, zend_class_entry *class_entry_Stringable) +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_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, 5, class_entry_MongoDB_BSON_ObjectIdInterface, class_entry_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable, class_entry_Stringable); + zend_class_implements(class_entry, 4, class_entry_MongoDB_BSON_ObjectIdInterface, class_entry_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Stringable); return class_entry; } diff --git a/src/BSON/PackedArray.c b/src/BSON/PackedArray.c index 3aad77d3e..166dd0e78 100644 --- a/src/BSON/PackedArray.c +++ b/src/BSON/PackedArray.c @@ -19,8 +19,6 @@ #include #include #include -#include -#include #ifdef HAVE_CONFIG_H #include "config.h" @@ -401,62 +399,6 @@ static PHP_METHOD(MongoDB_BSON_PackedArray, __set_state) php_phongo_packedarray_init_from_hash(intern, props); } -static PHP_METHOD(MongoDB_BSON_PackedArray, serialize) -{ - php_phongo_packedarray_t* intern; - zval retval; - php_serialize_data_t var_hash; - smart_str buf = { 0 }; - zend_string* str; - - intern = Z_PACKEDARRAY_OBJ_P(getThis()); - - PHONGO_PARSE_PARAMETERS_NONE(); - - array_init_size(&retval, 1); - str = php_base64_encode(bson_get_data(intern->bson), intern->bson->len); - ADD_ASSOC_STR(&retval, "data", str); - - PHP_VAR_SERIALIZE_INIT(var_hash); - php_var_serialize(&buf, &retval, &var_hash); - smart_str_0(&buf); - PHP_VAR_SERIALIZE_DESTROY(var_hash); - - PHONGO_RETVAL_SMART_STR(buf); - - zend_string_free(str); - smart_str_free(&buf); - zval_ptr_dtor(&retval); -} - -static PHP_METHOD(MongoDB_BSON_PackedArray, unserialize) -{ - php_phongo_packedarray_t* intern; - char* serialized; - size_t serialized_len; - zval props; - php_unserialize_data_t var_hash; - - intern = Z_PACKEDARRAY_OBJ_P(getThis()); - - PHONGO_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STRING(serialized, serialized_len) - PHONGO_PARSE_PARAMETERS_END(); - - PHP_VAR_UNSERIALIZE_INIT(var_hash); - if (!php_var_unserialize(&props, (const unsigned char**) &serialized, (unsigned char*) serialized + serialized_len, &var_hash)) { - zval_ptr_dtor(&props); - phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "%s unserialization failed", ZSTR_VAL(php_phongo_packedarray_ce->name)); - - PHP_VAR_UNSERIALIZE_DESTROY(var_hash); - return; - } - PHP_VAR_UNSERIALIZE_DESTROY(var_hash); - - php_phongo_packedarray_init_from_hash(intern, HASH_OF(&props)); - zval_ptr_dtor(&props); -} - static PHP_METHOD(MongoDB_BSON_PackedArray, __serialize) { PHONGO_PARSE_PARAMETERS_NONE(); @@ -624,7 +566,7 @@ void php_phongo_packedarray_unset_dimension(zend_object* object, zval* offset) 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, zend_ce_stringable); + php_phongo_packedarray_ce = register_class_MongoDB_BSON_PackedArray(zend_ce_aggregate, zend_ce_arrayaccess, php_phongo_type_ce, zend_ce_stringable); php_phongo_packedarray_ce->create_object = php_phongo_packedarray_create_object; memcpy(&php_phongo_handler_packedarray, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); diff --git a/src/BSON/PackedArray.stub.php b/src/BSON/PackedArray.stub.php index b9165777f..95e9c3683 100644 --- a/src/BSON/PackedArray.stub.php +++ b/src/BSON/PackedArray.stub.php @@ -7,7 +7,7 @@ namespace MongoDB\BSON; -final class PackedArray implements \IteratorAggregate, \Serializable, \ArrayAccess, Type, \Stringable +final class PackedArray implements \IteratorAggregate, \ArrayAccess, Type, \Stringable { private function __construct() {} @@ -39,10 +39,6 @@ final public function __toString(): string {} final public static function __set_state(array $properties): PackedArray {} - final public function serialize(): string {} - - final public function unserialize(string $data): void {} - final public function __unserialize(array $data): void {} final public function __serialize(): array {} diff --git a/src/BSON/PackedArray_arginfo.h b/src/BSON/PackedArray_arginfo.h index 9668bec1f..d8d8f1773 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: 3e80c319dc75e220bd5f471badb7ac40888ddd87 */ + * Stub hash: 497915f5aa3a10fc5e4bf222c82cdcb5c891a1bd */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_PackedArray___construct, 0, 0, 0) ZEND_END_ARG_INFO() @@ -55,12 +55,6 @@ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_BSON_PackedArray___ ZEND_ARG_TYPE_INFO(0, properties, IS_ARRAY, 0) ZEND_END_ARG_INFO() -#define arginfo_class_MongoDB_BSON_PackedArray_serialize arginfo_class_MongoDB_BSON_PackedArray_toCanonicalExtendedJSON - -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() - 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) ZEND_END_ARG_INFO() @@ -84,8 +78,6 @@ static ZEND_METHOD(MongoDB_BSON_PackedArray, offsetSet); static ZEND_METHOD(MongoDB_BSON_PackedArray, offsetUnset); static ZEND_METHOD(MongoDB_BSON_PackedArray, __toString); static ZEND_METHOD(MongoDB_BSON_PackedArray, __set_state); -static ZEND_METHOD(MongoDB_BSON_PackedArray, serialize); -static ZEND_METHOD(MongoDB_BSON_PackedArray, unserialize); static ZEND_METHOD(MongoDB_BSON_PackedArray, __unserialize); static ZEND_METHOD(MongoDB_BSON_PackedArray, __serialize); @@ -106,21 +98,19 @@ static const zend_function_entry class_MongoDB_BSON_PackedArray_methods[] = { ZEND_ME(MongoDB_BSON_PackedArray, offsetUnset, arginfo_class_MongoDB_BSON_PackedArray_offsetUnset, ZEND_ACC_PUBLIC) 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) - ZEND_ME(MongoDB_BSON_PackedArray, unserialize, arginfo_class_MongoDB_BSON_PackedArray_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) 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, zend_class_entry *class_entry_Stringable) +static zend_class_entry *register_class_MongoDB_BSON_PackedArray(zend_class_entry *class_entry_IteratorAggregate, 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, 5, class_entry_IteratorAggregate, class_entry_Serializable, class_entry_ArrayAccess, class_entry_MongoDB_BSON_Type, class_entry_Stringable); + zend_class_implements(class_entry, 4, class_entry_IteratorAggregate, class_entry_ArrayAccess, class_entry_MongoDB_BSON_Type, class_entry_Stringable); return class_entry; } diff --git a/src/BSON/Regex.c b/src/BSON/Regex.c index 6c741d2de..a75b75e39 100644 --- a/src/BSON/Regex.c +++ b/src/BSON/Regex.c @@ -15,7 +15,6 @@ */ #include -#include #include #include @@ -194,60 +193,6 @@ static PHP_METHOD(MongoDB_BSON_Regex, jsonSerialize) ADD_ASSOC_STRINGL(return_value, "$options", intern->flags, intern->flags_len); } -static PHP_METHOD(MongoDB_BSON_Regex, serialize) -{ - php_phongo_regex_t* intern; - zval retval; - php_serialize_data_t var_hash; - smart_str buf = { 0 }; - - intern = Z_REGEX_OBJ_P(getThis()); - - PHONGO_PARSE_PARAMETERS_NONE(); - - array_init_size(&retval, 2); - ADD_ASSOC_STRINGL(&retval, "pattern", intern->pattern, intern->pattern_len); - ADD_ASSOC_STRINGL(&retval, "flags", intern->flags, intern->flags_len); - - PHP_VAR_SERIALIZE_INIT(var_hash); - php_var_serialize(&buf, &retval, &var_hash); - smart_str_0(&buf); - PHP_VAR_SERIALIZE_DESTROY(var_hash); - - PHONGO_RETVAL_SMART_STR(buf); - - smart_str_free(&buf); - zval_ptr_dtor(&retval); -} - -static PHP_METHOD(MongoDB_BSON_Regex, unserialize) -{ - php_phongo_regex_t* intern; - char* serialized; - size_t serialized_len; - zval props; - php_unserialize_data_t var_hash; - - intern = Z_REGEX_OBJ_P(getThis()); - - PHONGO_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STRING(serialized, serialized_len) - PHONGO_PARSE_PARAMETERS_END(); - - PHP_VAR_UNSERIALIZE_INIT(var_hash); - if (!php_var_unserialize(&props, (const unsigned char**) &serialized, (unsigned char*) serialized + serialized_len, &var_hash)) { - zval_ptr_dtor(&props); - phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "%s unserialization failed", ZSTR_VAL(php_phongo_regex_ce->name)); - - PHP_VAR_UNSERIALIZE_DESTROY(var_hash); - return; - } - PHP_VAR_UNSERIALIZE_DESTROY(var_hash); - - php_phongo_regex_init_from_hash(intern, HASH_OF(&props)); - zval_ptr_dtor(&props); -} - static PHP_METHOD(MongoDB_BSON_Regex, __serialize) { PHONGO_PARSE_PARAMETERS_NONE(); @@ -351,7 +296,7 @@ static HashTable* php_phongo_regex_get_properties(zend_object* object) 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, zend_ce_stringable); + 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_stringable); php_phongo_regex_ce->create_object = php_phongo_regex_create_object; memcpy(&php_phongo_handler_regex, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); diff --git a/src/BSON/Regex.stub.php b/src/BSON/Regex.stub.php index e4224bdfb..4d6aa596d 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, \Stringable +final class Regex implements RegexInterface, \JsonSerializable, Type, \Stringable { final public function __construct(string $pattern, string $flags = '') {} @@ -19,10 +19,6 @@ final public function __toString(): string {} final public static function __set_state(array $properties): Regex {} - final public function serialize(): string {} - - final public function unserialize(string $data): void {} - final public function __unserialize(array $data): void {} final public function __serialize(): array {} diff --git a/src/BSON/Regex_arginfo.h b/src/BSON/Regex_arginfo.h index 9b5b09dbf..d9b2ccd4a 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: aa53c6b26b0dea96d357c59b51b4c6e9f5a21317 */ + * Stub hash: 5fb63bbe527f9b0cadf1898ac21e97bbba8dbb6c */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Regex___construct, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0) @@ -17,12 +17,6 @@ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_BSON_Regex___set_st ZEND_ARG_TYPE_INFO(0, properties, IS_ARRAY, 0) ZEND_END_ARG_INFO() -#define arginfo_class_MongoDB_BSON_Regex_serialize arginfo_class_MongoDB_BSON_Regex_getPattern - -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() - 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) ZEND_END_ARG_INFO() @@ -39,8 +33,6 @@ static ZEND_METHOD(MongoDB_BSON_Regex, getPattern); 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); -static ZEND_METHOD(MongoDB_BSON_Regex, unserialize); static ZEND_METHOD(MongoDB_BSON_Regex, __unserialize); static ZEND_METHOD(MongoDB_BSON_Regex, __serialize); static ZEND_METHOD(MongoDB_BSON_Regex, jsonSerialize); @@ -52,22 +44,20 @@ static const zend_function_entry class_MongoDB_BSON_Regex_methods[] = { ZEND_ME(MongoDB_BSON_Regex, getFlags, arginfo_class_MongoDB_BSON_Regex_getFlags, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) 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) - ZEND_ME(MongoDB_BSON_Regex, unserialize, arginfo_class_MongoDB_BSON_Regex_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) 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) ZEND_ME(MongoDB_BSON_Regex, jsonSerialize, arginfo_class_MongoDB_BSON_Regex_jsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) 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, zend_class_entry *class_entry_Stringable) +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_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, 5, class_entry_MongoDB_BSON_RegexInterface, class_entry_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable, class_entry_Stringable); + zend_class_implements(class_entry, 4, class_entry_MongoDB_BSON_RegexInterface, class_entry_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Stringable); return class_entry; } diff --git a/src/BSON/Symbol.c b/src/BSON/Symbol.c index 21523585e..a47b6c2fe 100644 --- a/src/BSON/Symbol.c +++ b/src/BSON/Symbol.c @@ -15,8 +15,6 @@ */ #include -#include -#include #include #include "php_phongo.h" @@ -121,59 +119,6 @@ static PHP_METHOD(MongoDB_BSON_Symbol, jsonSerialize) ADD_ASSOC_STRINGL(return_value, "$symbol", intern->symbol, intern->symbol_len); } -static PHP_METHOD(MongoDB_BSON_Symbol, serialize) -{ - php_phongo_symbol_t* intern; - zval retval; - php_serialize_data_t var_hash; - smart_str buf = { 0 }; - - intern = Z_SYMBOL_OBJ_P(getThis()); - - PHONGO_PARSE_PARAMETERS_NONE(); - - array_init_size(&retval, 1); - ADD_ASSOC_STRINGL(&retval, "symbol", intern->symbol, intern->symbol_len); - - PHP_VAR_SERIALIZE_INIT(var_hash); - php_var_serialize(&buf, &retval, &var_hash); - smart_str_0(&buf); - PHP_VAR_SERIALIZE_DESTROY(var_hash); - - PHONGO_RETVAL_SMART_STR(buf); - - smart_str_free(&buf); - zval_ptr_dtor(&retval); -} - -static PHP_METHOD(MongoDB_BSON_Symbol, unserialize) -{ - php_phongo_symbol_t* intern; - char* serialized; - size_t serialized_len; - zval props; - php_unserialize_data_t var_hash; - - intern = Z_SYMBOL_OBJ_P(getThis()); - - PHONGO_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STRING(serialized, serialized_len) - PHONGO_PARSE_PARAMETERS_END(); - - PHP_VAR_UNSERIALIZE_INIT(var_hash); - if (!php_var_unserialize(&props, (const unsigned char**) &serialized, (unsigned char*) serialized + serialized_len, &var_hash)) { - zval_ptr_dtor(&props); - phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "%s unserialization failed", ZSTR_VAL(php_phongo_symbol_ce->name)); - - PHP_VAR_UNSERIALIZE_DESTROY(var_hash); - return; - } - PHP_VAR_UNSERIALIZE_DESTROY(var_hash); - - php_phongo_symbol_init_from_hash(intern, HASH_OF(&props)); - zval_ptr_dtor(&props); -} - static PHP_METHOD(MongoDB_BSON_Symbol, __serialize) { PHONGO_PARSE_PARAMETERS_NONE(); @@ -265,7 +210,7 @@ static HashTable* php_phongo_symbol_get_properties(zend_object* object) 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, zend_ce_stringable); + php_phongo_symbol_ce = register_class_MongoDB_BSON_Symbol(php_phongo_json_serializable_ce, php_phongo_type_ce, zend_ce_stringable); php_phongo_symbol_ce->create_object = php_phongo_symbol_create_object; memcpy(&php_phongo_handler_symbol, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); diff --git a/src/BSON/Symbol.stub.php b/src/BSON/Symbol.stub.php index cb7ed7a73..3868488ae 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, \Stringable +final class Symbol implements \JsonSerializable, Type, \Stringable { final private function __construct() {} @@ -15,10 +15,6 @@ final public function __toString(): string {} final public static function __set_state(array $properties): Symbol {} - final public function serialize(): string {} - - final public function unserialize(string $data): void {} - final public function __unserialize(array $data): void {} final public function __serialize(): array {} diff --git a/src/BSON/Symbol_arginfo.h b/src/BSON/Symbol_arginfo.h index 628400dc9..6767b3527 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: d13589fe0654877d462494f88d99ff20d22cde24 */ + * Stub hash: 9bd846827a2c2fb7fd6c0cb853a3fec5756073e8 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Symbol___construct, 0, 0, 0) ZEND_END_ARG_INFO() @@ -11,12 +11,6 @@ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_BSON_Symbol___set_s ZEND_ARG_TYPE_INFO(0, properties, IS_ARRAY, 0) ZEND_END_ARG_INFO() -#define arginfo_class_MongoDB_BSON_Symbol_serialize arginfo_class_MongoDB_BSON_Symbol___toString - -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() - 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) ZEND_END_ARG_INFO() @@ -31,8 +25,6 @@ ZEND_END_ARG_INFO() 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); -static ZEND_METHOD(MongoDB_BSON_Symbol, unserialize); static ZEND_METHOD(MongoDB_BSON_Symbol, __unserialize); static ZEND_METHOD(MongoDB_BSON_Symbol, __serialize); static ZEND_METHOD(MongoDB_BSON_Symbol, jsonSerialize); @@ -42,22 +34,20 @@ static const zend_function_entry class_MongoDB_BSON_Symbol_methods[] = { ZEND_ME(MongoDB_BSON_Symbol, __construct, arginfo_class_MongoDB_BSON_Symbol___construct, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL) 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) - ZEND_ME(MongoDB_BSON_Symbol, unserialize, arginfo_class_MongoDB_BSON_Symbol_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) 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) ZEND_ME(MongoDB_BSON_Symbol, jsonSerialize, arginfo_class_MongoDB_BSON_Symbol_jsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) 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, zend_class_entry *class_entry_Stringable) +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_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, 4, class_entry_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable, class_entry_Stringable); + zend_class_implements(class_entry, 3, class_entry_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Stringable); return class_entry; } diff --git a/src/BSON/Timestamp.c b/src/BSON/Timestamp.c index 6d0df3a4c..99c0ed85b 100644 --- a/src/BSON/Timestamp.c +++ b/src/BSON/Timestamp.c @@ -15,8 +15,6 @@ */ #include -#include -#include #include #include "php_phongo.h" @@ -236,67 +234,6 @@ static PHP_METHOD(MongoDB_BSON_Timestamp, jsonSerialize) } } -static PHP_METHOD(MongoDB_BSON_Timestamp, serialize) -{ - php_phongo_timestamp_t* intern; - zval retval; - php_serialize_data_t var_hash; - smart_str buf = { 0 }; - char s_increment[12]; - char s_timestamp[12]; - int s_increment_len; - int s_timestamp_len; - - intern = Z_TIMESTAMP_OBJ_P(getThis()); - - PHONGO_PARSE_PARAMETERS_NONE(); - - s_increment_len = snprintf(s_increment, sizeof(s_increment), "%" PRIu32, intern->increment); - s_timestamp_len = snprintf(s_timestamp, sizeof(s_timestamp), "%" PRIu32, intern->timestamp); - - array_init_size(&retval, 2); - ADD_ASSOC_STRINGL(&retval, "increment", s_increment, s_increment_len); - ADD_ASSOC_STRINGL(&retval, "timestamp", s_timestamp, s_timestamp_len); - - PHP_VAR_SERIALIZE_INIT(var_hash); - php_var_serialize(&buf, &retval, &var_hash); - smart_str_0(&buf); - PHP_VAR_SERIALIZE_DESTROY(var_hash); - - PHONGO_RETVAL_SMART_STR(buf); - - smart_str_free(&buf); - zval_ptr_dtor(&retval); -} - -static PHP_METHOD(MongoDB_BSON_Timestamp, unserialize) -{ - php_phongo_timestamp_t* intern; - char* serialized; - size_t serialized_len; - zval props; - php_unserialize_data_t var_hash; - - intern = Z_TIMESTAMP_OBJ_P(getThis()); - - PHONGO_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STRING(serialized, serialized_len) - PHONGO_PARSE_PARAMETERS_END(); - - PHP_VAR_UNSERIALIZE_INIT(var_hash); - if (!php_var_unserialize(&props, (const unsigned char**) &serialized, (unsigned char*) serialized + serialized_len, &var_hash)) { - zval_ptr_dtor(&props); - phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "%s unserialization failed", ZSTR_VAL(php_phongo_timestamp_ce->name)); - - PHP_VAR_UNSERIALIZE_DESTROY(var_hash); - return; - } - PHP_VAR_UNSERIALIZE_DESTROY(var_hash); - - php_phongo_timestamp_init_from_hash(intern, HASH_OF(&props)); - zval_ptr_dtor(&props); -} - static PHP_METHOD(MongoDB_BSON_Timestamp, __serialize) { PHONGO_PARSE_PARAMETERS_NONE(); @@ -393,7 +330,7 @@ static HashTable* php_phongo_timestamp_get_properties(zend_object* object) 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, zend_ce_stringable); + 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_stringable); php_phongo_timestamp_ce->create_object = php_phongo_timestamp_create_object; memcpy(&php_phongo_handler_timestamp, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); diff --git a/src/BSON/Timestamp.stub.php b/src/BSON/Timestamp.stub.php index eaa86e993..ef575b394 100644 --- a/src/BSON/Timestamp.stub.php +++ b/src/BSON/Timestamp.stub.php @@ -7,7 +7,7 @@ namespace MongoDB\BSON; -final class Timestamp implements TimestampInterface, \JsonSerializable, Type, \Serializable, \Stringable +final class Timestamp implements TimestampInterface, \JsonSerializable, Type, \Stringable { final public function __construct(int|string $increment, int|string $timestamp) {} @@ -19,10 +19,6 @@ final public function __toString(): string {} final public static function __set_state(array $properties): Timestamp {} - final public function serialize(): string {} - - final public function unserialize(string $data): void {} - final public function __unserialize(array $data): void {} final public function __serialize(): array {} diff --git a/src/BSON/Timestamp_arginfo.h b/src/BSON/Timestamp_arginfo.h index 9bfe856a5..531709748 100644 --- a/src/BSON/Timestamp_arginfo.h +++ b/src/BSON/Timestamp_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 32e036d627150cc5d09cf687eb4ae0e469fbc198 */ + * Stub hash: 0b768cfa7860b1bde5cbc32742528dd5754b9a85 */ 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) @@ -18,12 +18,6 @@ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_BSON_Timestamp___se ZEND_ARG_TYPE_INFO(0, properties, IS_ARRAY, 0) ZEND_END_ARG_INFO() -#define arginfo_class_MongoDB_BSON_Timestamp_serialize arginfo_class_MongoDB_BSON_Timestamp___toString - -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() - 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) ZEND_END_ARG_INFO() @@ -40,8 +34,6 @@ 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); -static ZEND_METHOD(MongoDB_BSON_Timestamp, unserialize); static ZEND_METHOD(MongoDB_BSON_Timestamp, __unserialize); static ZEND_METHOD(MongoDB_BSON_Timestamp, __serialize); static ZEND_METHOD(MongoDB_BSON_Timestamp, jsonSerialize); @@ -53,22 +45,20 @@ static const zend_function_entry class_MongoDB_BSON_Timestamp_methods[] = { 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) - ZEND_ME(MongoDB_BSON_Timestamp, unserialize, arginfo_class_MongoDB_BSON_Timestamp_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) 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) ZEND_ME(MongoDB_BSON_Timestamp, jsonSerialize, arginfo_class_MongoDB_BSON_Timestamp_jsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) 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, zend_class_entry *class_entry_Stringable) +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_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, 5, class_entry_MongoDB_BSON_TimestampInterface, class_entry_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable, class_entry_Stringable); + zend_class_implements(class_entry, 4, class_entry_MongoDB_BSON_TimestampInterface, class_entry_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Stringable); return class_entry; } diff --git a/src/BSON/UTCDateTime.c b/src/BSON/UTCDateTime.c index 4bdc45b93..568b06bdd 100644 --- a/src/BSON/UTCDateTime.c +++ b/src/BSON/UTCDateTime.c @@ -18,9 +18,7 @@ #include #include -#include #include -#include #include #include "php_phongo.h" @@ -296,59 +294,6 @@ static PHP_METHOD(MongoDB_BSON_UTCDateTime, jsonSerialize) } } -static PHP_METHOD(MongoDB_BSON_UTCDateTime, serialize) -{ - php_phongo_utcdatetime_t* intern; - zval retval; - php_serialize_data_t var_hash; - smart_str buf = { 0 }; - - intern = Z_UTCDATETIME_OBJ_P(getThis()); - - PHONGO_PARSE_PARAMETERS_NONE(); - - array_init_size(&retval, 1); - ADD_ASSOC_INT64_AS_STRING(&retval, "milliseconds", intern->milliseconds); - - PHP_VAR_SERIALIZE_INIT(var_hash); - php_var_serialize(&buf, &retval, &var_hash); - smart_str_0(&buf); - PHP_VAR_SERIALIZE_DESTROY(var_hash); - - PHONGO_RETVAL_SMART_STR(buf); - - smart_str_free(&buf); - zval_ptr_dtor(&retval); -} - -static PHP_METHOD(MongoDB_BSON_UTCDateTime, unserialize) -{ - php_phongo_utcdatetime_t* intern; - char* serialized; - size_t serialized_len; - zval props; - php_unserialize_data_t var_hash; - - intern = Z_UTCDATETIME_OBJ_P(getThis()); - - PHONGO_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STRING(serialized, serialized_len) - PHONGO_PARSE_PARAMETERS_END(); - - PHP_VAR_UNSERIALIZE_INIT(var_hash); - if (!php_var_unserialize(&props, (const unsigned char**) &serialized, (unsigned char*) serialized + serialized_len, &var_hash)) { - zval_ptr_dtor(&props); - phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "%s unserialization failed", ZSTR_VAL(php_phongo_utcdatetime_ce->name)); - - PHP_VAR_UNSERIALIZE_DESTROY(var_hash); - return; - } - PHP_VAR_UNSERIALIZE_DESTROY(var_hash); - - php_phongo_utcdatetime_init_from_hash(intern, HASH_OF(&props)); - zval_ptr_dtor(&props); -} - static PHP_METHOD(MongoDB_BSON_UTCDateTime, __serialize) { PHONGO_PARSE_PARAMETERS_NONE(); @@ -440,7 +385,7 @@ static HashTable* php_phongo_utcdatetime_get_properties(zend_object* object) 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, zend_ce_stringable); + 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_stringable); php_phongo_utcdatetime_ce->create_object = php_phongo_utcdatetime_create_object; memcpy(&php_phongo_handler_utcdatetime, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); diff --git a/src/BSON/UTCDateTime.stub.php b/src/BSON/UTCDateTime.stub.php index eec9c4cc0..30c201706 100644 --- a/src/BSON/UTCDateTime.stub.php +++ b/src/BSON/UTCDateTime.stub.php @@ -7,7 +7,7 @@ namespace MongoDB\BSON; -final class UTCDateTime implements UTCDateTimeInterface, \JsonSerializable, Type, \Serializable, \Stringable +final class UTCDateTime implements UTCDateTimeInterface, \JsonSerializable, Type, \Stringable { final public function __construct(int|string|float|\DateTimeInterface|Int64|null $milliseconds = null) {} @@ -19,10 +19,6 @@ final public function __toString(): string {} final public static function __set_state(array $properties): UTCDateTime {} - final public function serialize(): string {} - - final public function unserialize(string $data): void {} - final public function __unserialize(array $data): void {} final public function __serialize(): array {} diff --git a/src/BSON/UTCDateTime_arginfo.h b/src/BSON/UTCDateTime_arginfo.h index fe150a340..75a3862aa 100644 --- a/src/BSON/UTCDateTime_arginfo.h +++ b/src/BSON/UTCDateTime_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: ab30193571615b458a7ba01eb20da36ef1ecaf64 */ + * Stub hash: be638e28e19d1e9c040365f20b306b82dbfadf75 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_UTCDateTime___construct, 0, 0, 0) ZEND_ARG_OBJ_TYPE_MASK(0, milliseconds, DateTimeInterface|MongoDB\\BSON\\Int64, MAY_BE_LONG|MAY_BE_STRING|MAY_BE_DOUBLE|MAY_BE_NULL, "null") @@ -18,12 +18,6 @@ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_BSON_UTCDateTime___ ZEND_ARG_TYPE_INFO(0, properties, IS_ARRAY, 0) ZEND_END_ARG_INFO() -#define arginfo_class_MongoDB_BSON_UTCDateTime_serialize arginfo_class_MongoDB_BSON_UTCDateTime___toString - -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() - 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) ZEND_END_ARG_INFO() @@ -40,8 +34,6 @@ 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); -static ZEND_METHOD(MongoDB_BSON_UTCDateTime, unserialize); static ZEND_METHOD(MongoDB_BSON_UTCDateTime, __unserialize); static ZEND_METHOD(MongoDB_BSON_UTCDateTime, __serialize); static ZEND_METHOD(MongoDB_BSON_UTCDateTime, jsonSerialize); @@ -53,22 +45,20 @@ static const zend_function_entry class_MongoDB_BSON_UTCDateTime_methods[] = { 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) - ZEND_ME(MongoDB_BSON_UTCDateTime, unserialize, arginfo_class_MongoDB_BSON_UTCDateTime_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) 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) ZEND_ME(MongoDB_BSON_UTCDateTime, jsonSerialize, arginfo_class_MongoDB_BSON_UTCDateTime_jsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) 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, zend_class_entry *class_entry_Stringable) +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_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, 5, class_entry_MongoDB_BSON_UTCDateTimeInterface, class_entry_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable, class_entry_Stringable); + zend_class_implements(class_entry, 4, class_entry_MongoDB_BSON_UTCDateTimeInterface, class_entry_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Stringable); return class_entry; } diff --git a/src/BSON/Undefined.c b/src/BSON/Undefined.c index e3130f032..b240c1208 100644 --- a/src/BSON/Undefined.c +++ b/src/BSON/Undefined.c @@ -15,8 +15,6 @@ */ #include -#include -#include #include #include "php_phongo.h" @@ -54,23 +52,6 @@ static PHP_METHOD(MongoDB_BSON_Undefined, jsonSerialize) ADD_ASSOC_BOOL_EX(return_value, "$undefined", 1); } -static PHP_METHOD(MongoDB_BSON_Undefined, serialize) -{ - PHONGO_PARSE_PARAMETERS_NONE(); - - RETURN_STRING(""); -} - -static PHP_METHOD(MongoDB_BSON_Undefined, unserialize) -{ - char* serialized; - size_t serialized_len; - - PHONGO_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STRING(serialized, serialized_len) - PHONGO_PARSE_PARAMETERS_END(); -} - static PHP_METHOD(MongoDB_BSON_Undefined, __serialize) { PHONGO_PARSE_PARAMETERS_NONE(); @@ -111,7 +92,7 @@ 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, zend_ce_stringable); + php_phongo_undefined_ce = register_class_MongoDB_BSON_Undefined(php_phongo_json_serializable_ce, php_phongo_type_ce, zend_ce_stringable); php_phongo_undefined_ce->create_object = php_phongo_undefined_create_object; memcpy(&php_phongo_handler_undefined, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); diff --git a/src/BSON/Undefined.stub.php b/src/BSON/Undefined.stub.php index 66c634c6e..3014b05c4 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, \Stringable +final class Undefined implements \JsonSerializable, Type, \Stringable { final private function __construct() {} @@ -15,10 +15,6 @@ final public function __toString(): string {} final public static function __set_state(array $properties): Undefined {} - final public function serialize(): string {} - - final public function unserialize(string $data): void {} - final public function __unserialize(array $data): void {} final public function __serialize(): array {} diff --git a/src/BSON/Undefined_arginfo.h b/src/BSON/Undefined_arginfo.h index 2b8a6041e..17962329c 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: 19f544907b65caa4d9e82581531195d1dca026fd */ + * Stub hash: 4f9631736bdc048203268e88e70cc395b383aee4 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Undefined___construct, 0, 0, 0) ZEND_END_ARG_INFO() @@ -11,12 +11,6 @@ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_BSON_Undefined___se ZEND_ARG_TYPE_INFO(0, properties, IS_ARRAY, 0) ZEND_END_ARG_INFO() -#define arginfo_class_MongoDB_BSON_Undefined_serialize arginfo_class_MongoDB_BSON_Undefined___toString - -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() - 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) ZEND_END_ARG_INFO() @@ -31,8 +25,6 @@ ZEND_END_ARG_INFO() 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); -static ZEND_METHOD(MongoDB_BSON_Undefined, unserialize); static ZEND_METHOD(MongoDB_BSON_Undefined, __unserialize); static ZEND_METHOD(MongoDB_BSON_Undefined, __serialize); static ZEND_METHOD(MongoDB_BSON_Undefined, jsonSerialize); @@ -42,22 +34,20 @@ static const zend_function_entry class_MongoDB_BSON_Undefined_methods[] = { ZEND_ME(MongoDB_BSON_Undefined, __construct, arginfo_class_MongoDB_BSON_Undefined___construct, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL) 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) - ZEND_ME(MongoDB_BSON_Undefined, unserialize, arginfo_class_MongoDB_BSON_Undefined_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) 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) ZEND_ME(MongoDB_BSON_Undefined, jsonSerialize, arginfo_class_MongoDB_BSON_Undefined_jsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) 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, zend_class_entry *class_entry_Stringable) +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_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, 4, class_entry_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable, class_entry_Stringable); + zend_class_implements(class_entry, 3, class_entry_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Stringable); return class_entry; } diff --git a/src/MongoDB/ReadConcern.c b/src/MongoDB/ReadConcern.c index 6458bd750..54ed384db 100644 --- a/src/MongoDB/ReadConcern.c +++ b/src/MongoDB/ReadConcern.c @@ -17,8 +17,6 @@ #include "mongoc/mongoc.h" #include -#include -#include #include #include "php_phongo.h" @@ -158,74 +156,6 @@ static PHP_METHOD(MongoDB_Driver_ReadConcern, bsonSerialize) convert_to_object(return_value); } -static PHP_METHOD(MongoDB_Driver_ReadConcern, serialize) -{ - php_phongo_readconcern_t* intern; - zval retval; - php_serialize_data_t var_hash; - smart_str buf = { 0 }; - const char* level; - - intern = Z_READCONCERN_OBJ_P(getThis()); - - PHONGO_PARSE_PARAMETERS_NONE(); - - if (!intern->read_concern) { - return; - } - - level = mongoc_read_concern_get_level(intern->read_concern); - - if (!level) { - RETURN_STRING(""); - } - - array_init_size(&retval, 1); - ADD_ASSOC_STRING(&retval, "level", level); - - PHP_VAR_SERIALIZE_INIT(var_hash); - php_var_serialize(&buf, &retval, &var_hash); - smart_str_0(&buf); - PHP_VAR_SERIALIZE_DESTROY(var_hash); - - PHONGO_RETVAL_SMART_STR(buf); - - smart_str_free(&buf); - zval_ptr_dtor(&retval); -} - -static PHP_METHOD(MongoDB_Driver_ReadConcern, unserialize) -{ - php_phongo_readconcern_t* intern; - char* serialized; - size_t serialized_len; - zval props; - php_unserialize_data_t var_hash; - - intern = Z_READCONCERN_OBJ_P(getThis()); - - PHONGO_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STRING(serialized, serialized_len) - PHONGO_PARSE_PARAMETERS_END(); - - if (!serialized_len) { - return; - } - - PHP_VAR_UNSERIALIZE_INIT(var_hash); - if (!php_var_unserialize(&props, (const unsigned char**) &serialized, (unsigned char*) serialized + serialized_len, &var_hash)) { - zval_ptr_dtor(&props); - phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "%s unserialization failed", ZSTR_VAL(php_phongo_readconcern_ce->name)); - - PHP_VAR_UNSERIALIZE_DESTROY(var_hash); - return; - } - PHP_VAR_UNSERIALIZE_DESTROY(var_hash); - - php_phongo_readconcern_init_from_hash(intern, HASH_OF(&props)); - zval_ptr_dtor(&props); -} - static PHP_METHOD(MongoDB_Driver_ReadConcern, __serialize) { PHONGO_PARSE_PARAMETERS_NONE(); @@ -288,7 +218,7 @@ static HashTable* php_phongo_readconcern_get_properties(zend_object* object) void php_phongo_readconcern_init_ce(INIT_FUNC_ARGS) { - php_phongo_readconcern_ce = register_class_MongoDB_Driver_ReadConcern(php_phongo_serializable_ce, zend_ce_serializable); + php_phongo_readconcern_ce = register_class_MongoDB_Driver_ReadConcern(php_phongo_serializable_ce); php_phongo_readconcern_ce->create_object = php_phongo_readconcern_create_object; memcpy(&php_phongo_handler_readconcern, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); diff --git a/src/MongoDB/ReadConcern.stub.php b/src/MongoDB/ReadConcern.stub.php index 7365273e4..d72467fe7 100644 --- a/src/MongoDB/ReadConcern.stub.php +++ b/src/MongoDB/ReadConcern.stub.php @@ -7,7 +7,7 @@ namespace MongoDB\Driver; -final class ReadConcern implements \MongoDB\BSON\Serializable, \Serializable +final class ReadConcern implements \MongoDB\BSON\Serializable { /** * @var string @@ -49,10 +49,6 @@ final public static function __set_state(array $properties): ReadConcern {} final public function bsonSerialize(): \stdClass {} - final public function serialize(): string {} - - final public function unserialize(string $data): void {} - final public function __unserialize(array $data): void {} final public function __serialize(): array {} diff --git a/src/MongoDB/ReadConcern_arginfo.h b/src/MongoDB/ReadConcern_arginfo.h index d55f93c37..680b5311e 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: d039252f9f7e9b8c30ba4794d488ad7c5cd493d2 */ + * Stub hash: 2eb20e3e6be24e99cbbfe9d7888d5b8b99fc609f */ 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") @@ -18,13 +18,6 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_ReadConcern_bsonSerialize, 0, 0, stdClass, 0) 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() - -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() - 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) ZEND_END_ARG_INFO() @@ -38,8 +31,6 @@ static ZEND_METHOD(MongoDB_Driver_ReadConcern, getLevel); 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); -static ZEND_METHOD(MongoDB_Driver_ReadConcern, unserialize); static ZEND_METHOD(MongoDB_Driver_ReadConcern, __unserialize); static ZEND_METHOD(MongoDB_Driver_ReadConcern, __serialize); @@ -50,21 +41,19 @@ static const zend_function_entry class_MongoDB_Driver_ReadConcern_methods[] = { ZEND_ME(MongoDB_Driver_ReadConcern, isDefault, arginfo_class_MongoDB_Driver_ReadConcern_isDefault, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) 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) - ZEND_ME(MongoDB_Driver_ReadConcern, unserialize, arginfo_class_MongoDB_Driver_ReadConcern_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) 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 }; -static zend_class_entry *register_class_MongoDB_Driver_ReadConcern(zend_class_entry *class_entry_MongoDB_BSON_Serializable, zend_class_entry *class_entry_Serializable) +static zend_class_entry *register_class_MongoDB_Driver_ReadConcern(zend_class_entry *class_entry_MongoDB_BSON_Serializable) { zend_class_entry ce, *class_entry; INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "ReadConcern", class_MongoDB_Driver_ReadConcern_methods); class_entry = zend_register_internal_class_ex(&ce, NULL); class_entry->ce_flags |= ZEND_ACC_FINAL; - zend_class_implements(class_entry, 2, class_entry_MongoDB_BSON_Serializable, class_entry_Serializable); + zend_class_implements(class_entry, 1, class_entry_MongoDB_BSON_Serializable); zval const_LINEARIZABLE_value; zend_string *const_LINEARIZABLE_value_str = zend_string_init(MONGOC_READ_CONCERN_LEVEL_LINEARIZABLE, strlen(MONGOC_READ_CONCERN_LEVEL_LINEARIZABLE), 1); diff --git a/src/MongoDB/ReadPreference.c b/src/MongoDB/ReadPreference.c index 430ec274b..0928bfbc1 100644 --- a/src/MongoDB/ReadPreference.c +++ b/src/MongoDB/ReadPreference.c @@ -18,8 +18,6 @@ #include "mongoc/mongoc.h" #include -#include -#include #include #include "php_array_api.h" @@ -458,105 +456,6 @@ static PHP_METHOD(MongoDB_Driver_ReadPreference, bsonSerialize) convert_to_object(return_value); } -static PHP_METHOD(MongoDB_Driver_ReadPreference, serialize) -{ - php_phongo_readpreference_t* intern; - zval retval; - php_serialize_data_t var_hash; - smart_str buf = { 0 }; - const bson_t* tags; - const bson_t* hedge; - int64_t maxStalenessSeconds; - - intern = Z_READPREFERENCE_OBJ_P(getThis()); - - PHONGO_PARSE_PARAMETERS_NONE(); - - if (!intern->read_preference) { - return; - } - - tags = mongoc_read_prefs_get_tags(intern->read_preference); - maxStalenessSeconds = mongoc_read_prefs_get_max_staleness_seconds(intern->read_preference); - hedge = mongoc_read_prefs_get_hedge(intern->read_preference); - - array_init_size(&retval, 4); - - ADD_ASSOC_STRING(&retval, "mode", php_phongo_readpreference_get_mode_string(intern->read_preference)); - - if (!bson_empty0(tags)) { - php_phongo_bson_state state; - - PHONGO_BSON_INIT_DEBUG_STATE(state); - - if (!php_phongo_bson_to_zval_ex(tags, &state)) { - zval_ptr_dtor(&state.zchild); - return; - } - - ADD_ASSOC_ZVAL_EX(&retval, "tags", &state.zchild); - } - - if (maxStalenessSeconds != MONGOC_NO_MAX_STALENESS) { - ADD_ASSOC_LONG_EX(&retval, "maxStalenessSeconds", maxStalenessSeconds); - } - - if (!bson_empty0(hedge)) { - php_phongo_bson_state state; - - PHONGO_BSON_INIT_STATE(state); - - if (!php_phongo_bson_to_zval_ex(hedge, &state)) { - zval_ptr_dtor(&state.zchild); - return; - } - - ADD_ASSOC_ZVAL_EX(&retval, "hedge", &state.zchild); - } - - PHP_VAR_SERIALIZE_INIT(var_hash); - php_var_serialize(&buf, &retval, &var_hash); - smart_str_0(&buf); - PHP_VAR_SERIALIZE_DESTROY(var_hash); - - PHONGO_RETVAL_SMART_STR(buf); - - smart_str_free(&buf); - zval_ptr_dtor(&retval); -} - -static PHP_METHOD(MongoDB_Driver_ReadPreference, unserialize) -{ - php_phongo_readpreference_t* intern; - char* serialized; - size_t serialized_len; - zval props; - php_unserialize_data_t var_hash; - - intern = Z_READPREFERENCE_OBJ_P(getThis()); - - PHONGO_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STRING(serialized, serialized_len) - PHONGO_PARSE_PARAMETERS_END(); - - if (!serialized_len) { - return; - } - - PHP_VAR_UNSERIALIZE_INIT(var_hash); - if (!php_var_unserialize(&props, (const unsigned char**) &serialized, (unsigned char*) serialized + serialized_len, &var_hash)) { - zval_ptr_dtor(&props); - phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "%s unserialization failed", ZSTR_VAL(php_phongo_readpreference_ce->name)); - - PHP_VAR_UNSERIALIZE_DESTROY(var_hash); - return; - } - PHP_VAR_UNSERIALIZE_DESTROY(var_hash); - - php_phongo_readpreference_init_from_hash(intern, HASH_OF(&props)); - zval_ptr_dtor(&props); -} - static PHP_METHOD(MongoDB_Driver_ReadPreference, __serialize) { PHONGO_PARSE_PARAMETERS_NONE(); @@ -619,7 +518,7 @@ static HashTable* php_phongo_readpreference_get_properties(zend_object* object) void php_phongo_readpreference_init_ce(INIT_FUNC_ARGS) { - php_phongo_readpreference_ce = register_class_MongoDB_Driver_ReadPreference(php_phongo_serializable_ce, zend_ce_serializable); + php_phongo_readpreference_ce = register_class_MongoDB_Driver_ReadPreference(php_phongo_serializable_ce); php_phongo_readpreference_ce->create_object = php_phongo_readpreference_create_object; memcpy(&php_phongo_handler_readpreference, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); diff --git a/src/MongoDB/ReadPreference.stub.php b/src/MongoDB/ReadPreference.stub.php index 6b23579f9..6f2de0079 100644 --- a/src/MongoDB/ReadPreference.stub.php +++ b/src/MongoDB/ReadPreference.stub.php @@ -7,7 +7,7 @@ namespace MongoDB\Driver; -final class ReadPreference implements \MongoDB\BSON\Serializable, \Serializable +final class ReadPreference implements \MongoDB\BSON\Serializable { /** * @var string @@ -65,10 +65,6 @@ final public static function __set_state(array $properties): ReadPreference {} final public function bsonSerialize(): \stdClass {} - final public function serialize(): string {} - - final public function unserialize(string $data): void {} - final public function __unserialize(array $data): void {} final public function __serialize(): array {} diff --git a/src/MongoDB/ReadPreference_arginfo.h b/src/MongoDB/ReadPreference_arginfo.h index a4bbe0642..dfba8feb5 100644 --- a/src/MongoDB/ReadPreference_arginfo.h +++ b/src/MongoDB/ReadPreference_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 3fa545a3ff56acac4567ef25a48d87881711985c */ + * Stub hash: 27261ceb122b2783b1fba08be5c17b4f48ab8523 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_ReadPreference___construct, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, mode, IS_STRING, 0) @@ -26,12 +26,6 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_ReadPreference_bsonSerialize, 0, 0, stdClass, 0) ZEND_END_ARG_INFO() -#define arginfo_class_MongoDB_Driver_ReadPreference_serialize arginfo_class_MongoDB_Driver_ReadPreference_getModeString - -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() - 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) ZEND_END_ARG_INFO() @@ -46,8 +40,6 @@ static ZEND_METHOD(MongoDB_Driver_ReadPreference, getModeString); 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); -static ZEND_METHOD(MongoDB_Driver_ReadPreference, unserialize); static ZEND_METHOD(MongoDB_Driver_ReadPreference, __unserialize); static ZEND_METHOD(MongoDB_Driver_ReadPreference, __serialize); @@ -60,21 +52,19 @@ static const zend_function_entry class_MongoDB_Driver_ReadPreference_methods[] = ZEND_ME(MongoDB_Driver_ReadPreference, getTagSets, arginfo_class_MongoDB_Driver_ReadPreference_getTagSets, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) 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) - ZEND_ME(MongoDB_Driver_ReadPreference, unserialize, arginfo_class_MongoDB_Driver_ReadPreference_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) 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 }; -static zend_class_entry *register_class_MongoDB_Driver_ReadPreference(zend_class_entry *class_entry_MongoDB_BSON_Serializable, zend_class_entry *class_entry_Serializable) +static zend_class_entry *register_class_MongoDB_Driver_ReadPreference(zend_class_entry *class_entry_MongoDB_BSON_Serializable) { zend_class_entry ce, *class_entry; INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "ReadPreference", class_MongoDB_Driver_ReadPreference_methods); class_entry = zend_register_internal_class_ex(&ce, NULL); class_entry->ce_flags |= ZEND_ACC_FINAL; - zend_class_implements(class_entry, 2, class_entry_MongoDB_BSON_Serializable, class_entry_Serializable); + zend_class_implements(class_entry, 1, class_entry_MongoDB_BSON_Serializable); zval const_PRIMARY_value; zend_string *const_PRIMARY_value_str = zend_string_init(PHONGO_READ_PRIMARY, strlen(PHONGO_READ_PRIMARY), 1); diff --git a/src/MongoDB/ServerApi.c b/src/MongoDB/ServerApi.c index 2a74db0b7..3dd6f6264 100644 --- a/src/MongoDB/ServerApi.c +++ b/src/MongoDB/ServerApi.c @@ -17,8 +17,6 @@ #include "mongoc/mongoc.h" #include -#include -#include #include #include "php_phongo.h" @@ -186,76 +184,6 @@ static PHP_METHOD(MongoDB_Driver_ServerApi, bsonSerialize) convert_to_object(return_value); } -static PHP_METHOD(MongoDB_Driver_ServerApi, serialize) -{ - php_phongo_serverapi_t* intern; - zval retval; - php_serialize_data_t var_hash; - smart_str buf = { 0 }; - - intern = Z_SERVERAPI_OBJ_P(getThis()); - - PHONGO_PARSE_PARAMETERS_NONE(); - - array_init_size(&retval, 3); - - ADD_ASSOC_STRING(&retval, "version", mongoc_server_api_version_to_string(mongoc_server_api_get_version(intern->server_api))); - - if (mongoc_optional_is_set(mongoc_server_api_get_strict(intern->server_api))) { - ADD_ASSOC_BOOL_EX(&retval, "strict", mongoc_optional_value(mongoc_server_api_get_strict(intern->server_api))); - } else { - ADD_ASSOC_NULL_EX(&retval, "strict"); - } - - if (mongoc_optional_is_set(mongoc_server_api_get_deprecation_errors(intern->server_api))) { - ADD_ASSOC_BOOL_EX(&retval, "deprecationErrors", mongoc_optional_value(mongoc_server_api_get_deprecation_errors(intern->server_api))); - } else { - ADD_ASSOC_NULL_EX(&retval, "deprecationErrors"); - } - - PHP_VAR_SERIALIZE_INIT(var_hash); - php_var_serialize(&buf, &retval, &var_hash); - smart_str_0(&buf); - PHP_VAR_SERIALIZE_DESTROY(var_hash); - - PHONGO_RETVAL_SMART_STR(buf); - - smart_str_free(&buf); - zval_ptr_dtor(&retval); -} - -static PHP_METHOD(MongoDB_Driver_ServerApi, unserialize) -{ - php_phongo_serverapi_t* intern; - char* serialized; - size_t serialized_len; - zval props; - php_unserialize_data_t var_hash; - - intern = Z_SERVERAPI_OBJ_P(getThis()); - - PHONGO_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STRING(serialized, serialized_len) - PHONGO_PARSE_PARAMETERS_END(); - - if (!serialized_len) { - return; - } - - PHP_VAR_UNSERIALIZE_INIT(var_hash); - if (!php_var_unserialize(&props, (const unsigned char**) &serialized, (unsigned char*) serialized + serialized_len, &var_hash)) { - zval_ptr_dtor(&props); - phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "%s unserialization failed", ZSTR_VAL(php_phongo_serverapi_ce->name)); - - PHP_VAR_UNSERIALIZE_DESTROY(var_hash); - return; - } - PHP_VAR_UNSERIALIZE_DESTROY(var_hash); - - php_phongo_serverapi_init_from_hash(intern, HASH_OF(&props)); - zval_ptr_dtor(&props); -} - static PHP_METHOD(MongoDB_Driver_ServerApi, __serialize) { PHONGO_PARSE_PARAMETERS_NONE(); @@ -318,7 +246,7 @@ static HashTable* php_phongo_serverapi_get_properties(zend_object* object) void php_phongo_serverapi_init_ce(INIT_FUNC_ARGS) { - php_phongo_serverapi_ce = register_class_MongoDB_Driver_ServerApi(php_phongo_serializable_ce, zend_ce_serializable); + php_phongo_serverapi_ce = register_class_MongoDB_Driver_ServerApi(php_phongo_serializable_ce); php_phongo_serverapi_ce->create_object = php_phongo_serverapi_create_object; memcpy(&php_phongo_handler_serverapi, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); diff --git a/src/MongoDB/ServerApi.stub.php b/src/MongoDB/ServerApi.stub.php index 21db917ad..b95d7b5cb 100644 --- a/src/MongoDB/ServerApi.stub.php +++ b/src/MongoDB/ServerApi.stub.php @@ -7,7 +7,7 @@ namespace MongoDB\Driver; -final class ServerApi implements \MongoDB\BSON\Serializable, \Serializable +final class ServerApi implements \MongoDB\BSON\Serializable { /** @var string */ public const V1 = '1'; @@ -18,10 +18,6 @@ final public static function __set_state(array $properties): ServerApi {} final public function bsonSerialize(): \stdClass {} - final public function serialize(): string {} - - final public function unserialize(string $data): void {} - final public function __unserialize(array $data): void {} final public function __serialize(): array {} diff --git a/src/MongoDB/ServerApi_arginfo.h b/src/MongoDB/ServerApi_arginfo.h index 7c39cac5b..e102c7a9c 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: 44bcb97e14839e750c86309b7b9d2d861db89910 */ + * Stub hash: 74dd9fd0766587d269341f3c74a43ab9959a03a4 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_ServerApi___construct, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, version, IS_STRING, 0) @@ -14,13 +14,6 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_ServerApi_bsonSerialize, 0, 0, stdClass, 0) 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() - -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() - 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) ZEND_END_ARG_INFO() @@ -32,8 +25,6 @@ ZEND_END_ARG_INFO() 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); -static ZEND_METHOD(MongoDB_Driver_ServerApi, unserialize); static ZEND_METHOD(MongoDB_Driver_ServerApi, __unserialize); static ZEND_METHOD(MongoDB_Driver_ServerApi, __serialize); @@ -42,21 +33,19 @@ static const zend_function_entry class_MongoDB_Driver_ServerApi_methods[] = { ZEND_ME(MongoDB_Driver_ServerApi, __construct, arginfo_class_MongoDB_Driver_ServerApi___construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) 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) - ZEND_ME(MongoDB_Driver_ServerApi, unserialize, arginfo_class_MongoDB_Driver_ServerApi_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) 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 }; -static zend_class_entry *register_class_MongoDB_Driver_ServerApi(zend_class_entry *class_entry_MongoDB_BSON_Serializable, zend_class_entry *class_entry_Serializable) +static zend_class_entry *register_class_MongoDB_Driver_ServerApi(zend_class_entry *class_entry_MongoDB_BSON_Serializable) { zend_class_entry ce, *class_entry; INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "ServerApi", class_MongoDB_Driver_ServerApi_methods); class_entry = zend_register_internal_class_ex(&ce, NULL); class_entry->ce_flags |= ZEND_ACC_FINAL; - zend_class_implements(class_entry, 2, class_entry_MongoDB_BSON_Serializable, class_entry_Serializable); + zend_class_implements(class_entry, 1, class_entry_MongoDB_BSON_Serializable); zval const_V1_value; zend_string *const_V1_value_str = zend_string_init("1", strlen("1"), 1); diff --git a/src/MongoDB/WriteConcern.c b/src/MongoDB/WriteConcern.c index 4a5b26d85..4fa975838 100644 --- a/src/MongoDB/WriteConcern.c +++ b/src/MongoDB/WriteConcern.c @@ -17,8 +17,6 @@ #include "mongoc/mongoc.h" #include -#include -#include #include #include "php_phongo.h" @@ -343,93 +341,6 @@ static PHP_METHOD(MongoDB_Driver_WriteConcern, bsonSerialize) convert_to_object(return_value); } -static PHP_METHOD(MongoDB_Driver_WriteConcern, serialize) -{ - php_phongo_writeconcern_t* intern; - zval retval; - php_serialize_data_t var_hash; - smart_str buf = { 0 }; - const char* wtag; - int32_t w; - int64_t wtimeout; - - intern = Z_WRITECONCERN_OBJ_P(getThis()); - - PHONGO_PARSE_PARAMETERS_NONE(); - - if (!intern->write_concern) { - return; - } - - wtag = mongoc_write_concern_get_wtag(intern->write_concern); - w = mongoc_write_concern_get_w(intern->write_concern); - wtimeout = mongoc_write_concern_get_wtimeout_int64(intern->write_concern); - - array_init_size(&retval, 3); - - if (wtag) { - ADD_ASSOC_STRING(&retval, "w", wtag); - } else if (mongoc_write_concern_get_wmajority(intern->write_concern)) { - ADD_ASSOC_STRING(&retval, "w", PHONGO_WRITE_CONCERN_W_MAJORITY); - } else if (w != MONGOC_WRITE_CONCERN_W_DEFAULT) { - ADD_ASSOC_LONG_EX(&retval, "w", w); - } - - if (mongoc_write_concern_journal_is_set(intern->write_concern)) { - ADD_ASSOC_BOOL_EX(&retval, "j", mongoc_write_concern_get_journal(intern->write_concern)); - } - - if (wtimeout != 0) { - if (wtimeout > INT32_MAX || wtimeout < INT32_MIN) { - ADD_ASSOC_INT64_AS_STRING(&retval, "wtimeout", wtimeout); - } else { - ADD_ASSOC_LONG_EX(&retval, "wtimeout", wtimeout); - } - } - - PHP_VAR_SERIALIZE_INIT(var_hash); - php_var_serialize(&buf, &retval, &var_hash); - smart_str_0(&buf); - PHP_VAR_SERIALIZE_DESTROY(var_hash); - - PHONGO_RETVAL_SMART_STR(buf); - - smart_str_free(&buf); - zval_ptr_dtor(&retval); -} - -static PHP_METHOD(MongoDB_Driver_WriteConcern, unserialize) -{ - php_phongo_writeconcern_t* intern; - char* serialized; - size_t serialized_len; - zval props; - php_unserialize_data_t var_hash; - - intern = Z_WRITECONCERN_OBJ_P(getThis()); - - PHONGO_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STRING(serialized, serialized_len) - PHONGO_PARSE_PARAMETERS_END(); - - if (!serialized_len) { - return; - } - - PHP_VAR_UNSERIALIZE_INIT(var_hash); - if (!php_var_unserialize(&props, (const unsigned char**) &serialized, (unsigned char*) serialized + serialized_len, &var_hash)) { - zval_ptr_dtor(&props); - phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "%s unserialization failed", ZSTR_VAL(php_phongo_writeconcern_ce->name)); - - PHP_VAR_UNSERIALIZE_DESTROY(var_hash); - return; - } - PHP_VAR_UNSERIALIZE_DESTROY(var_hash); - - php_phongo_writeconcern_init_from_hash(intern, HASH_OF(&props)); - zval_ptr_dtor(&props); -} - static PHP_METHOD(MongoDB_Driver_WriteConcern, __serialize) { PHONGO_PARSE_PARAMETERS_NONE(); @@ -492,7 +403,7 @@ static HashTable* php_phongo_writeconcern_get_properties(zend_object* object) void php_phongo_writeconcern_init_ce(INIT_FUNC_ARGS) { - php_phongo_writeconcern_ce = register_class_MongoDB_Driver_WriteConcern(php_phongo_serializable_ce, zend_ce_serializable); + php_phongo_writeconcern_ce = register_class_MongoDB_Driver_WriteConcern(php_phongo_serializable_ce); php_phongo_writeconcern_ce->create_object = php_phongo_writeconcern_create_object; memcpy(&php_phongo_handler_writeconcern, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); diff --git a/src/MongoDB/WriteConcern.stub.php b/src/MongoDB/WriteConcern.stub.php index f46ca6dca..d21bb472e 100644 --- a/src/MongoDB/WriteConcern.stub.php +++ b/src/MongoDB/WriteConcern.stub.php @@ -7,7 +7,7 @@ namespace MongoDB\Driver; -final class WriteConcern implements \MongoDB\BSON\Serializable, \Serializable +final class WriteConcern implements \MongoDB\BSON\Serializable { /** * @var string @@ -29,10 +29,6 @@ final public static function __set_state(array $properties): WriteConcern {} final public function bsonSerialize(): \stdClass {} - final public function serialize(): string {} - - final public function unserialize(string $data): void {} - final public function __unserialize(array $data): void {} final public function __serialize(): array {} diff --git a/src/MongoDB/WriteConcern_arginfo.h b/src/MongoDB/WriteConcern_arginfo.h index 22c7a3975..32586f1af 100644 --- a/src/MongoDB/WriteConcern_arginfo.h +++ b/src/MongoDB/WriteConcern_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 5b78e4484cebcf558867cf47defea6ae25b42d76 */ + * Stub hash: 1a859d43ebd260284aff6114b169cbe70869ae61 */ 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) @@ -26,13 +26,6 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_WriteConcern_bsonSerialize, 0, 0, stdClass, 0) 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() - -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() - 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) ZEND_END_ARG_INFO() @@ -48,8 +41,6 @@ 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); -static ZEND_METHOD(MongoDB_Driver_WriteConcern, unserialize); static ZEND_METHOD(MongoDB_Driver_WriteConcern, __unserialize); static ZEND_METHOD(MongoDB_Driver_WriteConcern, __serialize); @@ -62,21 +53,19 @@ static const zend_function_entry class_MongoDB_Driver_WriteConcern_methods[] = { 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) - ZEND_ME(MongoDB_Driver_WriteConcern, unserialize, arginfo_class_MongoDB_Driver_WriteConcern_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) 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 }; -static zend_class_entry *register_class_MongoDB_Driver_WriteConcern(zend_class_entry *class_entry_MongoDB_BSON_Serializable, zend_class_entry *class_entry_Serializable) +static zend_class_entry *register_class_MongoDB_Driver_WriteConcern(zend_class_entry *class_entry_MongoDB_BSON_Serializable) { zend_class_entry ce, *class_entry; INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "WriteConcern", class_MongoDB_Driver_WriteConcern_methods); class_entry = zend_register_internal_class_ex(&ce, NULL); class_entry->ce_flags |= ZEND_ACC_FINAL; - zend_class_implements(class_entry, 2, class_entry_MongoDB_BSON_Serializable, class_entry_Serializable); + zend_class_implements(class_entry, 1, class_entry_MongoDB_BSON_Serializable); zval const_MAJORITY_value; zend_string *const_MAJORITY_value_str = zend_string_init(PHONGO_WRITE_CONCERN_W_MAJORITY, strlen(PHONGO_WRITE_CONCERN_W_MAJORITY), 1); diff --git a/tests/bson/bson-binary-serialization_error-001.phpt b/tests/bson/bson-binary-serialization_error-001.phpt deleted file mode 100644 index 03eee3d85..000000000 --- a/tests/bson/bson-binary-serialization_error-001.phpt +++ /dev/null @@ -1,30 +0,0 @@ ---TEST-- -MongoDB\BSON\Binary unserialization requires "data" string and "type" integer fields (Serializable interface) ---FILE-- - -===DONE=== - ---EXPECT-- -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -MongoDB\BSON\Binary initialization requires "data" string and "type" integer fields -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -MongoDB\BSON\Binary initialization requires "data" string and "type" integer fields -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -MongoDB\BSON\Binary initialization requires "data" string and "type" integer fields -===DONE=== diff --git a/tests/bson/bson-binary-serialization_error-002.phpt b/tests/bson/bson-binary-serialization_error-002.phpt deleted file mode 100644 index 8d9ffdb1a..000000000 --- a/tests/bson/bson-binary-serialization_error-002.phpt +++ /dev/null @@ -1,24 +0,0 @@ ---TEST-- -MongoDB\BSON\Binary unserialization requires unsigned 8-bit integer for type (Serializable interface) ---FILE-- - -===DONE=== - ---EXPECT-- -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Expected type to be an unsigned 8-bit integer, -1 given -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Expected type to be an unsigned 8-bit integer, 256 given -===DONE=== diff --git a/tests/bson/bson-binary-serialization_error-003.phpt b/tests/bson/bson-binary-serialization_error-003.phpt deleted file mode 100644 index afdf3330f..000000000 --- a/tests/bson/bson-binary-serialization_error-003.phpt +++ /dev/null @@ -1,36 +0,0 @@ ---TEST-- -MongoDB\BSON\Binary unserialization requires 16-byte data length for UUID types (Serializable interface) ---FILE-- - -===DONE=== - ---EXPECT-- -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Expected UUID length to be 16 bytes, 15 given -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Expected UUID length to be 16 bytes, 17 given -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Expected UUID length to be 16 bytes, 15 given -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Expected UUID length to be 16 bytes, 17 given -===DONE=== diff --git a/tests/bson/bson-dbpointer-serialization_error-001.phpt b/tests/bson/bson-dbpointer-serialization_error-001.phpt deleted file mode 100644 index 2b618f626..000000000 --- a/tests/bson/bson-dbpointer-serialization_error-001.phpt +++ /dev/null @@ -1,25 +0,0 @@ ---TEST-- -MongoDB\BSON\DBPointer unserialization requires "ref" and "id" string fields (Serializable interface) ---FILE-- - -===DONE=== - ---EXPECT-- -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -MongoDB\BSON\DBPointer initialization requires "ref" and "id" string fields -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -MongoDB\BSON\DBPointer initialization requires "ref" and "id" string fields -===DONE=== diff --git a/tests/bson/bson-dbpointer-serialization_error-002.phpt b/tests/bson/bson-dbpointer-serialization_error-002.phpt deleted file mode 100644 index b41784842..000000000 --- a/tests/bson/bson-dbpointer-serialization_error-002.phpt +++ /dev/null @@ -1,25 +0,0 @@ ---TEST-- -MongoDB\BSON\DBPointer unserialization requires "id" string field to be valid (Serializable interface) ---FILE-- - -===DONE=== - ---EXPECT-- -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Error parsing ObjectId string: QQQQ78accd485d55b4050000 -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Error parsing ObjectId string: 52e78accd485d55b4050000 -===DONE=== diff --git a/tests/bson/bson-decimal128-serialization_error-001.phpt b/tests/bson/bson-decimal128-serialization_error-001.phpt deleted file mode 100644 index 609b1305a..000000000 --- a/tests/bson/bson-decimal128-serialization_error-001.phpt +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -MongoDB\BSON\Decimal128 unserialization requires "dec" string field (Serializable interface) ---FILE-- - -===DONE=== - ---EXPECT-- -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -MongoDB\BSON\Decimal128 initialization requires "dec" string field -===DONE=== diff --git a/tests/bson/bson-decimal128-serialization_error-002.phpt b/tests/bson/bson-decimal128-serialization_error-002.phpt deleted file mode 100644 index ce6842885..000000000 --- a/tests/bson/bson-decimal128-serialization_error-002.phpt +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -MongoDB\BSON\Decimal128 unserialization requires valid decimal string (Serializable interface) ---FILE-- - -===DONE=== - ---EXPECT-- -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Error parsing Decimal128 string: INVALID -===DONE=== diff --git a/tests/bson/bson-int64-serialization_error-001.phpt b/tests/bson/bson-int64-serialization_error-001.phpt deleted file mode 100644 index 65b2bae7f..000000000 --- a/tests/bson/bson-int64-serialization_error-001.phpt +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -MongoDB\BSON\Int64 unserialization requires "int" string field (Serializable interface) ---FILE-- - -===DONE=== - ---EXPECT-- -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -MongoDB\BSON\Int64 initialization requires "integer" string field -===DONE=== diff --git a/tests/bson/bson-int64-serialization_error-002.phpt b/tests/bson/bson-int64-serialization_error-002.phpt deleted file mode 100644 index aa6129e62..000000000 --- a/tests/bson/bson-int64-serialization_error-002.phpt +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -MongoDB\BSON\Int64 unserialization requires "int" string field to be valid (Serializable interface) ---FILE-- - -===DONE=== - ---EXPECT-- -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Error parsing "1234.5678" as 64-bit integer for MongoDB\BSON\Int64 initialization -===DONE=== diff --git a/tests/bson/bson-javascript-serialization_error-001.phpt b/tests/bson/bson-javascript-serialization_error-001.phpt deleted file mode 100644 index 0c8953bcb..000000000 --- a/tests/bson/bson-javascript-serialization_error-001.phpt +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -MongoDB\BSON\Javascript unserialization requires "code" string field (Serializable interface) ---FILE-- - -===DONE=== - ---EXPECT-- -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -MongoDB\BSON\Javascript initialization requires "code" string field -===DONE=== diff --git a/tests/bson/bson-javascript-serialization_error-002.phpt b/tests/bson/bson-javascript-serialization_error-002.phpt deleted file mode 100644 index c1790ddbf..000000000 --- a/tests/bson/bson-javascript-serialization_error-002.phpt +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -MongoDB\BSON\Javascript unserialization expects optional scope to be array or object (Serializable interface) ---FILE-- - -===DONE=== - ---EXPECT-- -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Expected scope to be array or object, string given -===DONE=== diff --git a/tests/bson/bson-javascript-serialization_error-003.phpt b/tests/bson/bson-javascript-serialization_error-003.phpt deleted file mode 100644 index ac297bbbb..000000000 --- a/tests/bson/bson-javascript-serialization_error-003.phpt +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -MongoDB\BSON\Javascript unserialization does not allow code to contain null bytes (Serializable interface) ---FILE-- - -===DONE=== - ---EXPECT-- -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Code cannot contain null bytes -===DONE=== diff --git a/tests/bson/bson-objectid-serialization_error-001.phpt b/tests/bson/bson-objectid-serialization_error-001.phpt deleted file mode 100644 index 0956772aa..000000000 --- a/tests/bson/bson-objectid-serialization_error-001.phpt +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -MongoDB\BSON\ObjectId unserialization requires "oid" string field (Serializable interface) ---FILE-- - -===DONE=== - ---EXPECT-- -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -MongoDB\BSON\ObjectId initialization requires "oid" string field -===DONE=== diff --git a/tests/bson/bson-objectid-serialization_error-002.phpt b/tests/bson/bson-objectid-serialization_error-002.phpt deleted file mode 100644 index faf361270..000000000 --- a/tests/bson/bson-objectid-serialization_error-002.phpt +++ /dev/null @@ -1,24 +0,0 @@ ---TEST-- -MongoDB\BSON\ObjectId unserialization requires valid hex string (Serializable interface) ---FILE-- - -===DONE=== - ---EXPECT-- -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Error parsing ObjectId string: 0123456789abcdefghijklmn -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Error parsing ObjectId string: INVALID -===DONE=== diff --git a/tests/bson/bson-regex-serialization-003.phpt b/tests/bson/bson-regex-serialization-003.phpt deleted file mode 100644 index 9082da859..000000000 --- a/tests/bson/bson-regex-serialization-003.phpt +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -MongoDB\BSON\Regex unserialization will alphabetize flags (Serializable interface) ---FILE-- - -===DONE=== - ---EXPECTF-- -object(MongoDB\BSON\Regex)#%d (%d) { - ["pattern"]=> - string(6) "regexp" - ["flags"]=> - string(6) "ilmsux" -} -===DONE=== diff --git a/tests/bson/bson-regex-serialization_error-001.phpt b/tests/bson/bson-regex-serialization_error-001.phpt deleted file mode 100644 index be9a1f636..000000000 --- a/tests/bson/bson-regex-serialization_error-001.phpt +++ /dev/null @@ -1,30 +0,0 @@ ---TEST-- -MongoDB\BSON\Regex unserialization requires "pattern" and "flags" string fields (Serializable interface) ---FILE-- - -===DONE=== - ---EXPECT-- -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -MongoDB\BSON\Regex initialization requires "pattern" and "flags" string fields -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -MongoDB\BSON\Regex initialization requires "pattern" and "flags" string fields -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -MongoDB\BSON\Regex initialization requires "pattern" and "flags" string fields -===DONE=== diff --git a/tests/bson/bson-regex-serialization_error-002.phpt b/tests/bson/bson-regex-serialization_error-002.phpt deleted file mode 100644 index ff9edccc7..000000000 --- a/tests/bson/bson-regex-serialization_error-002.phpt +++ /dev/null @@ -1,26 +0,0 @@ ---TEST-- -MongoDB\BSON\Regex unserialization does not allow pattern or flags to contain null bytes (Serializable interface) ---DESCRIPTION-- -BSON Corpus spec prose test #1 ---FILE-- - -===DONE=== - ---EXPECT-- -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Pattern cannot contain null bytes -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Flags cannot contain null bytes -===DONE=== diff --git a/tests/bson/bson-symbol-serialization_error-001.phpt b/tests/bson/bson-symbol-serialization_error-001.phpt deleted file mode 100644 index 1322e06df..000000000 --- a/tests/bson/bson-symbol-serialization_error-001.phpt +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -MongoDB\BSON\Symbol unserialization requires "symbol" string field (Serializable interface) ---FILE-- - -===DONE=== - ---EXPECT-- -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -MongoDB\BSON\Symbol initialization requires "symbol" string field -===DONE=== diff --git a/tests/bson/bson-symbol-serialization_error-002.phpt b/tests/bson/bson-symbol-serialization_error-002.phpt deleted file mode 100644 index f142ece5f..000000000 --- a/tests/bson/bson-symbol-serialization_error-002.phpt +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -MongoDB\BSON\Symbol unserialization does not allow string to contain null bytes (Serializable interface) ---FILE-- - -===DONE=== - ---EXPECT-- -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Symbol cannot contain null bytes -===DONE=== diff --git a/tests/bson/bson-timestamp-serialization_error-001.phpt b/tests/bson/bson-timestamp-serialization_error-001.phpt deleted file mode 100644 index c42947e5f..000000000 --- a/tests/bson/bson-timestamp-serialization_error-001.phpt +++ /dev/null @@ -1,36 +0,0 @@ ---TEST-- -MongoDB\BSON\Timestamp unserialization requires "increment" and "timestamp" integer fields (Serializable interface) ---FILE-- - -===DONE=== - ---EXPECT-- -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -MongoDB\BSON\Timestamp initialization requires "increment" and "timestamp" integer or numeric string fields -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -MongoDB\BSON\Timestamp initialization requires "increment" and "timestamp" integer or numeric string fields -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -MongoDB\BSON\Timestamp initialization requires "increment" and "timestamp" integer or numeric string fields -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -MongoDB\BSON\Timestamp initialization requires "increment" and "timestamp" integer or numeric string fields -===DONE=== diff --git a/tests/bson/bson-timestamp-serialization_error-002.phpt b/tests/bson/bson-timestamp-serialization_error-002.phpt deleted file mode 100644 index 9747e48cf..000000000 --- a/tests/bson/bson-timestamp-serialization_error-002.phpt +++ /dev/null @@ -1,36 +0,0 @@ ---TEST-- -MongoDB\BSON\Timestamp unserialization requires positive unsigned 32-bit integers (Serializable interface) ---FILE-- - -===DONE=== - ---EXPECT-- -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Expected increment to be an unsigned 32-bit integer, -1 given -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Expected increment to be an unsigned 32-bit integer, -2147483648 given -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Expected timestamp to be an unsigned 32-bit integer, -1 given -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Expected timestamp to be an unsigned 32-bit integer, -2147483648 given -===DONE=== diff --git a/tests/bson/bson-timestamp-serialization_error-003.phpt b/tests/bson/bson-timestamp-serialization_error-003.phpt deleted file mode 100644 index 68224b71b..000000000 --- a/tests/bson/bson-timestamp-serialization_error-003.phpt +++ /dev/null @@ -1,26 +0,0 @@ ---TEST-- -MongoDB\BSON\Timestamp unserialization requires 64-bit integers to be positive unsigned 32-bit integers (Serializable interface) ---SKIPIF-- - ---FILE-- - -===DONE=== - ---EXPECT-- -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Expected increment to be an unsigned 32-bit integer, 4294967296 given -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Expected timestamp to be an unsigned 32-bit integer, 4294967296 given -===DONE=== diff --git a/tests/bson/bson-timestamp-serialization_error-004.phpt b/tests/bson/bson-timestamp-serialization_error-004.phpt deleted file mode 100644 index 6d14b3f35..000000000 --- a/tests/bson/bson-timestamp-serialization_error-004.phpt +++ /dev/null @@ -1,24 +0,0 @@ ---TEST-- -MongoDB\BSON\Timestamp unserialization requires strings to parse as 64-bit integers (Serializable interface) ---FILE-- - -===DONE=== - ---EXPECT-- -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Error parsing "1.23" as 64-bit integer increment for MongoDB\BSON\Timestamp initialization -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Error parsing "5.67" as 64-bit integer timestamp for MongoDB\BSON\Timestamp initialization -===DONE=== diff --git a/tests/bson/bson-utcdatetime-serialization_error-001.phpt b/tests/bson/bson-utcdatetime-serialization_error-001.phpt deleted file mode 100644 index cbdfaa3da..000000000 --- a/tests/bson/bson-utcdatetime-serialization_error-001.phpt +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -MongoDB\BSON\UTCDateTime unserialization requires "milliseconds" integer or numeric string field (Serializable interface) ---FILE-- - -===DONE=== - ---EXPECT-- -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -MongoDB\BSON\UTCDateTime initialization requires "milliseconds" integer or numeric string field -===DONE=== diff --git a/tests/bson/bson-utcdatetime-serialization_error-002.phpt b/tests/bson/bson-utcdatetime-serialization_error-002.phpt deleted file mode 100644 index ad59d46dd..000000000 --- a/tests/bson/bson-utcdatetime-serialization_error-002.phpt +++ /dev/null @@ -1,37 +0,0 @@ ---TEST-- -MongoDB\BSON\UTCDateTime unserialization requires "milliseconds" string to parse as 64-bit integer (Serializable interface) ---FILE-- - -===DONE=== - ---EXPECT-- -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Error parsing "1234.5678" as 64-bit integer for MongoDB\BSON\UTCDateTime initialization -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Error parsing "9223372036854775808" as 64-bit integer for MongoDB\BSON\UTCDateTime initialization -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Error parsing "-9223372036854775809" as 64-bit integer for MongoDB\BSON\UTCDateTime initialization -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Error parsing "18446744073709551615" as 64-bit integer for MongoDB\BSON\UTCDateTime initialization -===DONE=== diff --git a/tests/bson/bug1598-001.phpt b/tests/bson/bug1598-001.phpt index 072144fb1..90fd0922c 100644 --- a/tests/bson/bug1598-001.phpt +++ b/tests/bson/bug1598-001.phpt @@ -2,11 +2,11 @@ PHPC-1598: BSON type get_gc should not invoke get_properties --FILE-- new MongoDB\BSON\Binary('foo', MongoDB\BSON\Binary::TYPE_GENERIC) ], - // Use serialized strings to construct types with disabled constructors - [ 'dbpointer' => unserialize('C:22:"MongoDB\BSON\DBPointer":76:{a:2:{s:3:"ref";s:11:"phongo.test";s:2:"id";s:24:"5a2e78accd485d55b4050000";}}') ], + [ 'dbpointer' => createDBPointer() ], [ 'decimal128' => new MongoDB\BSON\Decimal128('1234.5678') ], [ 'int64' => new MongoDB\BSON\Int64('9223372036854775807') ], // JavaScript w/ scope may not be necessary (same code path as w/o scope), but we'll test it anyway @@ -17,7 +17,7 @@ $tests = [ [ 'minkey' => new MongoDB\BSON\MinKey ], [ 'objectid' => new MongoDB\BSON\ObjectId ], [ 'regex' => new MongoDB\BSON\Regex('pattern', 'i') ], - [ 'symbol' => unserialize('C:19:"MongoDB\BSON\Symbol":38:{a:1:{s:6:"symbol";s:11:"symbolValue";}}') ], + [ 'symbol' => createSymbol() ], [ 'timestamp' => new MongoDB\BSON\Timestamp(1234, 5678) ], [ 'utcdatetime' => new MongoDB\BSON\UTCDateTime ], ]; diff --git a/tests/bson/bug1598-002.phpt b/tests/bson/bug1598-002.phpt index 7922a2235..de32da9a8 100644 --- a/tests/bson/bug1598-002.phpt +++ b/tests/bson/bug1598-002.phpt @@ -5,11 +5,11 @@ PHPC-1598: BSON type get_gc should delegate to zend_std_get_properties =', '8.1.99'); ?> --FILE-- new MongoDB\BSON\Binary('foo', MongoDB\BSON\Binary::TYPE_GENERIC) ], - // Use serialized strings to construct types with disabled constructors - [ 'dbpointer' => unserialize('C:22:"MongoDB\BSON\DBPointer":76:{a:2:{s:3:"ref";s:11:"phongo.test";s:2:"id";s:24:"5a2e78accd485d55b4050000";}}') ], + [ 'dbpointer' => createDBPointer(), ], [ 'decimal128' => new MongoDB\BSON\Decimal128('1234.5678') ], [ 'int64' => new MongoDB\BSON\Int64('9223372036854775807') ], // JavaScript w/ scope may not be necessary (same code path as w/o scope), but we'll test it anyway @@ -20,7 +20,7 @@ $tests = [ [ 'minkey' => new MongoDB\BSON\MinKey ], [ 'objectid' => new MongoDB\BSON\ObjectId ], [ 'regex' => new MongoDB\BSON\Regex('pattern', 'i') ], - [ 'symbol' => unserialize('C:19:"MongoDB\BSON\Symbol":38:{a:1:{s:6:"symbol";s:11:"symbolValue";}}') ], + [ 'symbol' => createSymbol() ], [ 'timestamp' => new MongoDB\BSON\Timestamp(1234, 5678) ], [ 'utcdatetime' => new MongoDB\BSON\UTCDateTime ], ]; diff --git a/tests/manager/manager-serialization_error-001.phpt b/tests/manager/manager-serialization_error-001.phpt index f551d2e59..e4b23c4fd 100644 --- a/tests/manager/manager-serialization_error-001.phpt +++ b/tests/manager/manager-serialization_error-001.phpt @@ -9,10 +9,6 @@ echo throws(function() { serialize(create_test_manager()); }, Exception::class), "\n"; -echo throws(function() { - unserialize('C:22:"MongoDB\Driver\Manager":0:{}'); -}, Exception::class), "\n"; - echo throws(function() { unserialize('O:22:"MongoDB\Driver\Manager":0:{}'); }, Exception::class), "\n"; @@ -25,6 +21,4 @@ OK: Got Exception Serialization of 'MongoDB\Driver\Manager' is not allowed OK: Got Exception Unserialization of 'MongoDB\Driver\Manager' is not allowed -OK: Got Exception -Unserialization of 'MongoDB\Driver\Manager' is not allowed ===DONE=== diff --git a/tests/readConcern/readconcern-serialization_error-001.phpt b/tests/readConcern/readconcern-serialization_error-001.phpt deleted file mode 100644 index 963ae2349..000000000 --- a/tests/readConcern/readconcern-serialization_error-001.phpt +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -MongoDB\Driver\ReadConcern unserialization errors (Serializable interface) ---FILE-- - -===DONE=== - ---EXPECT-- -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -MongoDB\Driver\ReadConcern initialization requires "level" string field -===DONE=== \ No newline at end of file diff --git a/tests/readPreference/readpreference-serialization_error-001.phpt b/tests/readPreference/readpreference-serialization_error-001.phpt deleted file mode 100644 index 0c6e3affb..000000000 --- a/tests/readPreference/readpreference-serialization_error-001.phpt +++ /dev/null @@ -1,28 +0,0 @@ ---TEST-- -MongoDB\Driver\ReadPreference unserialization errors (Serializable interface) ---FILE-- - -===DONE=== - ---EXPECT-- -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -MongoDB\Driver\ReadPreference initialization requires specific values for "mode" string field -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -MongoDB\Driver\ReadPreference initialization requires "mode" field to be string -===DONE=== diff --git a/tests/serverApi/serverApi-serialization_error-001.phpt b/tests/serverApi/serverApi-serialization_error-001.phpt deleted file mode 100644 index 9d02be6f1..000000000 --- a/tests/serverApi/serverApi-serialization_error-001.phpt +++ /dev/null @@ -1,30 +0,0 @@ ---TEST-- -MongoDB\Driver\ServerApi unserialization errors (Serializable interface) ---FILE-- - -===DONE=== - ---EXPECT-- -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -MongoDB\Driver\ServerApi initialization requires "version" field to be string -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -MongoDB\Driver\ServerApi initialization requires "strict" field to be bool or null -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -MongoDB\Driver\ServerApi initialization requires "deprecationErrors" field to be bool or null -===DONE=== diff --git a/tests/serverApi/serverApi-serialization_error-002.phpt b/tests/serverApi/serverApi-serialization_error-002.phpt index 95161f618..bfb76ff9e 100644 --- a/tests/serverApi/serverApi-serialization_error-002.phpt +++ b/tests/serverApi/serverApi-serialization_error-002.phpt @@ -6,15 +6,15 @@ MongoDB\Driver\ServerApi unserialization errors (__serialize and __unserialize) require_once __DIR__ . '/../utils/basic.inc'; echo throws(function() { - unserialize('C:24:"MongoDB\Driver\ServerApi":24:{a:1:{s:7:"version";i:0;}}'); + unserialize('O:24:"MongoDB\Driver\ServerApi":1:{s:7:"version";i:0;}'); }, 'MongoDB\Driver\Exception\InvalidArgumentException'), "\n"; echo throws(function() { - unserialize('C:24:"MongoDB\Driver\ServerApi":45:{a:2:{s:7:"version";s:1:"1";s:6:"strict";i:0;}}'); + unserialize('O:24:"MongoDB\Driver\ServerApi":2:{s:7:"version";s:1:"1";s:6:"strict";i:0;}'); }, 'MongoDB\Driver\Exception\InvalidArgumentException'), "\n"; echo throws(function() { - unserialize('C:24:"MongoDB\Driver\ServerApi":57:{a:2:{s:7:"version";s:1:"1";s:17:"deprecationErrors";i:0;}}'); + unserialize('O:24:"MongoDB\Driver\ServerApi":2:{s:7:"version";s:1:"1";s:17:"deprecationErrors";i:0;}'); }, 'MongoDB\Driver\Exception\InvalidArgumentException'), "\n"; ?> diff --git a/tests/utils/tools.php b/tests/utils/tools.php index 76d822a18..79f304d10 100644 --- a/tests/utils/tools.php +++ b/tests/utils/tools.php @@ -1,5 +1,7 @@ -===DONE=== - ---EXPECT-- -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Cannot enable journaling when using w = 0 -===DONE===