Skip to content

Commit 358fd2f

Browse files
authored
PHPC-2206: Implement BSON\Value class (#1412)
* First implementation for MongoDB\BSON\Value * Add is* methods to MongoDB\BSON\Value * Extract functions to create BSON instances * Add getters for all BSON types * Apply code review feedback * Rename BSON factory functions * Return bool in BSON factories * Clean up int64 compatibility macro includes * Use macro to throw unexpected BSON type exceptions * Extract int64 tests for BSON value * Add error test for BSON value factory * Implement debug output for BSON value instances * Remove object comparison handler * Implement tests for cloning BSON value instances * Add tests for isInt and getInt * Ensure stdbool.h is included for compat macros * Refactor phongo_bson_value_to_zval The new implementation no longer uses a bson_iter_t for simple values, but instantiates BSON objects directly. Arrays and documents are still passed to php_phongo_bson_to_zval_ex for convenience. * Refactor phongo_zval_to_bson_value * Return bson_value_t instances in BSON iterator * Return bson_value_t instances in Document::get * Return bson_value_t instances in PackedArray::get * Return BSON type instances in bson_value_t This includes a small change to return PHP objects for compatibility in ClientEncryption::decrypt and ClientEncryption::encrypt * Remove obsolete php_phongo_bson_iter_to_zval function * Use PHP values in debug output * Comprehensively test all BSON types * Implement serialisation of BSON Value instances * Drop isInt and getInt methods from BSON value class * Always return int64 instances in Value::getInt64 * Update serialisation and debug info for BSON classes With the new logic, debug output will always show raw BSON data and PHP data for documents and packed arrays. Serialised data will only contain raw BSON data. This also changes Int64 serialisation to always serialise as Int64 instances, regardless of value or platform. * Create Int64 instances directly * Add comment explaining extra property in get_debug_info * Clarify exception message when initialising Value instance * Simplify invocations of get_properties_hash with string type * Handle zval conversion error in get_properties_hash * Add comment noting phongo_bson_value_to_zval will throw * Fix zval capitalisation * Handle bson value conversion error on serialisation * Document exceptions when converting values to zval * Clean up unused macros * Add missing __set_state methods * Test MongoDB\BSON\Value::__set_state() * Skip __set_state test on PHP 7.2 * Change docblock to regular comment * Use new BSON value conversion function when encrypting data Since the encrypted data will always be a BSON binary object, there is no reason to use the legacy function to avoid receiving a Document or PackedArray instance.
1 parent c188621 commit 358fd2f

File tree

111 files changed

+6165
-556
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+6165
-556
lines changed

config.m4

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ if test "$PHP_MONGODB" != "no"; then
147147
src/BSON/Unserializable.c \
148148
src/BSON/UTCDateTime.c \
149149
src/BSON/UTCDateTimeInterface.c \
150+
src/BSON/Value.c \
150151
src/BSON/functions.c \
151152
src/MongoDB/BulkWrite.c \
152153
src/MongoDB/ClientEncryption.c \

config.w32

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ if (PHP_MONGODB != "no") {
121121

122122
EXTENSION("mongodb", "php_phongo.c", null, PHP_MONGODB_CFLAGS);
123123
MONGODB_ADD_SOURCES("/src", "phongo_apm.c phongo_bson.c phongo_bson_encode.c phongo_client.c phongo_compat.c phongo_error.c phongo_execute.c phongo_ini.c phongo_util.c");
124-
MONGODB_ADD_SOURCES("/src/BSON", "Binary.c BinaryInterface.c Document.c Iterator.c DBPointer.c Decimal128.c Decimal128Interface.c Int64.c Javascript.c JavascriptInterface.c MaxKey.c MaxKeyInterface.c MinKey.c MinKeyInterface.c ObjectId.c ObjectIdInterface.c PackedArray.c Persistable.c Regex.c RegexInterface.c Serializable.c Symbol.c Timestamp.c TimestampInterface.c Type.c Undefined.c Unserializable.c UTCDateTime.c UTCDateTimeInterface.c functions.c");
124+
MONGODB_ADD_SOURCES("/src/BSON", "Binary.c BinaryInterface.c Document.c Iterator.c DBPointer.c Decimal128.c Decimal128Interface.c Int64.c Javascript.c JavascriptInterface.c MaxKey.c MaxKeyInterface.c MinKey.c MinKeyInterface.c ObjectId.c ObjectIdInterface.c PackedArray.c Persistable.c Regex.c RegexInterface.c Serializable.c Symbol.c Timestamp.c TimestampInterface.c Type.c Undefined.c Unserializable.c UTCDateTime.c UTCDateTimeInterface.c Value.c functions.c");
125125
MONGODB_ADD_SOURCES("/src/MongoDB", "BulkWrite.c ClientEncryption.c Command.c Cursor.c CursorId.c CursorInterface.c Manager.c Query.c ReadConcern.c ReadPreference.c Server.c ServerApi.c ServerDescription.c Session.c TopologyDescription.c WriteConcern.c WriteConcernError.c WriteError.c WriteResult.c");
126126
MONGODB_ADD_SOURCES("/src/MongoDB/Exception", "AuthenticationException.c BulkWriteException.c CommandException.c ConnectionException.c ConnectionTimeoutException.c EncryptionException.c Exception.c ExecutionTimeoutException.c InvalidArgumentException.c LogicException.c RuntimeException.c ServerException.c SSLConnectionException.c UnexpectedValueException.c WriteException.c");
127127
MONGODB_ADD_SOURCES("/src/MongoDB/Monitoring", "CommandFailedEvent.c CommandStartedEvent.c CommandSubscriber.c CommandSucceededEvent.c SDAMSubscriber.c Subscriber.c ServerChangedEvent.c ServerClosedEvent.c ServerHeartbeatFailedEvent.c ServerHeartbeatStartedEvent.c ServerHeartbeatSucceededEvent.c ServerOpeningEvent.c TopologyChangedEvent.c TopologyClosedEvent.c TopologyOpeningEvent.c functions.c");

php_phongo.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ PHP_MINIT_FUNCTION(mongodb) /* {{{ */
207207
php_phongo_timestamp_interface_init_ce(INIT_FUNC_ARGS_PASSTHRU);
208208
php_phongo_utcdatetime_interface_init_ce(INIT_FUNC_ARGS_PASSTHRU);
209209

210+
php_phongo_value_init_ce(INIT_FUNC_ARGS_PASSTHRU);
210211
php_phongo_iterator_init_ce(INIT_FUNC_ARGS_PASSTHRU);
211212
php_phongo_packedarray_init_ce(INIT_FUNC_ARGS_PASSTHRU);
212213
php_phongo_document_init_ce(INIT_FUNC_ARGS_PASSTHRU);

src/BSON/Binary.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,3 +354,17 @@ void php_phongo_binary_init_ce(INIT_FUNC_ARGS)
354354
php_phongo_handler_binary.free_obj = php_phongo_binary_free_object;
355355
php_phongo_handler_binary.offset = XtOffsetOf(php_phongo_binary_t, std);
356356
}
357+
358+
bool phongo_binary_new(zval* object, const char* data, size_t data_len, bson_subtype_t type)
359+
{
360+
php_phongo_binary_t* intern;
361+
362+
object_init_ex(object, php_phongo_binary_ce);
363+
364+
intern = Z_BINARY_OBJ_P(object);
365+
intern->data = estrndup(data, data_len);
366+
intern->data_len = data_len;
367+
intern->type = (uint8_t) type;
368+
369+
return true;
370+
}

src/BSON/Binary.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,6 @@
1919

2020
#define PHONGO_BINARY_UUID_SIZE 16
2121

22+
bool phongo_binary_new(zval* object, const char* data, size_t data_len, bson_subtype_t type);
23+
2224
#endif /* PHONGO_BSON_BINARY_H */

src/BSON/DBPointer.c

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,24 @@ static PHP_METHOD(MongoDB_BSON_DBPointer, __toString)
109109
efree(retval);
110110
}
111111

112+
static PHP_METHOD(MongoDB_BSON_DBPointer, __set_state)
113+
{
114+
php_phongo_dbpointer_t* intern;
115+
HashTable* props;
116+
zval* array;
117+
118+
PHONGO_PARSE_PARAMETERS_START(1, 1)
119+
Z_PARAM_ARRAY(array)
120+
PHONGO_PARSE_PARAMETERS_END();
121+
122+
object_init_ex(return_value, php_phongo_dbpointer_ce);
123+
124+
intern = Z_DBPOINTER_OBJ_P(return_value);
125+
props = Z_ARRVAL_P(array);
126+
127+
php_phongo_dbpointer_init_from_hash(intern, props);
128+
}
129+
112130
static PHP_METHOD(MongoDB_BSON_DBPointer, jsonSerialize)
113131
{
114132
php_phongo_dbpointer_t* intern;
@@ -296,3 +314,17 @@ void php_phongo_dbpointer_init_ce(INIT_FUNC_ARGS)
296314
php_phongo_handler_dbpointer.free_obj = php_phongo_dbpointer_free_object;
297315
php_phongo_handler_dbpointer.offset = XtOffsetOf(php_phongo_dbpointer_t, std);
298316
}
317+
318+
bool phongo_dbpointer_new(zval* object, const char* ref, size_t ref_len, const bson_oid_t* oid)
319+
{
320+
php_phongo_dbpointer_t* intern;
321+
322+
object_init_ex(object, php_phongo_dbpointer_ce);
323+
324+
intern = Z_DBPOINTER_OBJ_P(object);
325+
intern->ref = estrndup(ref, ref_len);
326+
intern->ref_len = ref_len;
327+
bson_oid_to_string(oid, intern->id);
328+
329+
return true;
330+
}

src/BSON/DBPointer.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
* Copyright 2023-present MongoDB, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
#ifndef PHONGO_BSON_DBPOINTER_H
18+
#define PHONGO_BSON_DBPOINTER_H
19+
20+
bool phongo_dbpointer_new(zval* object, const char* ref, size_t ref_len, const bson_oid_t* oid);
21+
22+
#endif /* PHONGO_BSON_DBPOINTER_H */

src/BSON/DBPointer.stub.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ final class DBPointer implements \JsonSerializable, Type, \Serializable
1010
{
1111
final private function __construct() {}
1212

13+
final public static function __set_state(array $properties): DBPointer {}
14+
1315
final public function __toString(): string {}
1416

1517
final public function serialize(): string {}

src/BSON/DBPointer_arginfo.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 715bc228895c936eb673a93d58750c38fe83f210 */
2+
* Stub hash: 2e26331e12fe64ef077d0d2b37433d291cb87943 */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_DBPointer___construct, 0, 0, 0)
55
ZEND_END_ARG_INFO()
66

7+
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_BSON_DBPointer___set_state, 0, 1, MongoDB\\BSON\\DBPointer, 0)
8+
ZEND_ARG_TYPE_INFO(0, properties, IS_ARRAY, 0)
9+
ZEND_END_ARG_INFO()
10+
711
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_DBPointer___toString, 0, 0, IS_STRING, 0)
812
ZEND_END_ARG_INFO()
913

@@ -32,6 +36,7 @@ ZEND_END_ARG_INFO()
3236

3337

3438
static ZEND_METHOD(MongoDB_BSON_DBPointer, __construct);
39+
static ZEND_METHOD(MongoDB_BSON_DBPointer, __set_state);
3540
static ZEND_METHOD(MongoDB_BSON_DBPointer, __toString);
3641
static ZEND_METHOD(MongoDB_BSON_DBPointer, serialize);
3742
static ZEND_METHOD(MongoDB_BSON_DBPointer, unserialize);
@@ -47,6 +52,7 @@ static ZEND_METHOD(MongoDB_BSON_DBPointer, jsonSerialize);
4752

4853
static const zend_function_entry class_MongoDB_BSON_DBPointer_methods[] = {
4954
ZEND_ME(MongoDB_BSON_DBPointer, __construct, arginfo_class_MongoDB_BSON_DBPointer___construct, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
55+
ZEND_ME(MongoDB_BSON_DBPointer, __set_state, arginfo_class_MongoDB_BSON_DBPointer___set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
5056
ZEND_ME(MongoDB_BSON_DBPointer, __toString, arginfo_class_MongoDB_BSON_DBPointer___toString, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
5157
ZEND_ME(MongoDB_BSON_DBPointer, serialize, arginfo_class_MongoDB_BSON_DBPointer_serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
5258
ZEND_ME(MongoDB_BSON_DBPointer, unserialize, arginfo_class_MongoDB_BSON_DBPointer_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)

src/BSON/Decimal128.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,3 +289,16 @@ void php_phongo_decimal128_init_ce(INIT_FUNC_ARGS)
289289
php_phongo_handler_decimal128.free_obj = php_phongo_decimal128_free_object;
290290
php_phongo_handler_decimal128.offset = XtOffsetOf(php_phongo_decimal128_t, std);
291291
}
292+
293+
bool phongo_decimal128_new(zval* object, const bson_decimal128_t* decimal)
294+
{
295+
php_phongo_decimal128_t* intern;
296+
297+
object_init_ex(object, php_phongo_decimal128_ce);
298+
299+
intern = Z_DECIMAL128_OBJ_P(object);
300+
memcpy(&intern->decimal, decimal, sizeof(bson_decimal128_t));
301+
intern->initialized = true;
302+
303+
return true;
304+
}

src/BSON/Decimal128.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
* Copyright 2023-present MongoDB, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
#ifndef PHONGO_BSON_DECIMAL128_H
18+
#define PHONGO_BSON_DECIMAL128_H
19+
20+
bool phongo_decimal128_new(zval* object, const bson_decimal128_t* decimal);
21+
22+
#endif /* PHONGO_BSON_DECIMAL128_H */

src/BSON/Document.c

Lines changed: 47 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include "phongo_bson_encode.h"
3131
#include "BSON/Document_arginfo.h"
3232
#include "BSON/Iterator.h"
33+
#include "BSON/Value.h"
3334

3435
zend_class_entry* php_phongo_document_ce;
3536

@@ -57,14 +58,14 @@ static bool php_phongo_document_init_from_hash(php_phongo_document_t* intern, Ha
5758
return false;
5859
}
5960

60-
static HashTable* php_phongo_document_get_properties_hash(phongo_compat_object_handler_type* object, bool is_temp)
61+
static HashTable* php_phongo_document_get_properties_hash(phongo_compat_object_handler_type* object, bool is_temp, int size)
6162
{
6263
php_phongo_document_t* intern;
6364
HashTable* props;
6465

6566
intern = Z_OBJ_DOCUMENT(PHONGO_COMPAT_GET_OBJ(object));
6667

67-
PHONGO_GET_PROPERTY_HASH_INIT_PROPS(is_temp, intern, props, 1);
68+
PHONGO_GET_PROPERTY_HASH_INIT_PROPS(is_temp, intern, props, size);
6869

6970
if (!intern->bson) {
7071
return props;
@@ -186,7 +187,7 @@ static PHP_METHOD(MongoDB_BSON_Document, get)
186187
RETURN_NULL();
187188
}
188189

189-
php_phongo_bson_iter_to_zval(return_value, &iter);
190+
phongo_value_new(return_value, bson_iter_value(&iter));
190191
}
191192

192193
static PHP_METHOD(MongoDB_BSON_Document, getIterator)
@@ -356,7 +357,7 @@ static PHP_METHOD(MongoDB_BSON_Document, __serialize)
356357
{
357358
PHONGO_PARSE_PARAMETERS_NONE();
358359

359-
RETURN_ARR(php_phongo_document_get_properties_hash(PHONGO_COMPAT_OBJ_P(getThis()), true));
360+
RETURN_ARR(php_phongo_document_get_properties_hash(PHONGO_COMPAT_OBJ_P(getThis()), true, 1));
360361
}
361362

362363
static PHP_METHOD(MongoDB_BSON_Document, __unserialize)
@@ -432,13 +433,41 @@ static int php_phongo_document_compare_objects(zval* o1, zval* o2)
432433

433434
static HashTable* php_phongo_document_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp)
434435
{
436+
php_phongo_document_t* intern;
437+
HashTable* props;
438+
435439
*is_temp = 1;
436-
return php_phongo_document_get_properties_hash(object, true);
440+
intern = Z_OBJ_DOCUMENT(PHONGO_COMPAT_GET_OBJ(object));
441+
442+
/* This get_debug_info handler reports an additional property. This does not
443+
* conflict with other uses of php_phongo_document_get_properties_hash since
444+
* we always allocated a new HashTable with is_temp=true. */
445+
props = php_phongo_document_get_properties_hash(object, true, 2);
446+
447+
{
448+
php_phongo_bson_state state;
449+
450+
PHONGO_BSON_INIT_STATE(state);
451+
state.map.array.type = PHONGO_TYPEMAP_BSON;
452+
state.map.document.type = PHONGO_TYPEMAP_BSON;
453+
if (!php_phongo_bson_to_zval_ex(intern->bson, &state)) {
454+
zval_ptr_dtor(&state.zchild);
455+
goto failure;
456+
}
457+
458+
zend_hash_str_update(props, "value", sizeof("value") - 1, &state.zchild);
459+
}
460+
461+
return props;
462+
463+
failure:
464+
PHONGO_GET_PROPERTY_HASH_FREE_PROPS(is_temp, props);
465+
return NULL;
437466
}
438467

439468
static HashTable* php_phongo_document_get_properties(phongo_compat_object_handler_type* object)
440469
{
441-
return php_phongo_document_get_properties_hash(object, false);
470+
return php_phongo_document_get_properties_hash(object, false, 1);
442471
}
443472

444473
void php_phongo_document_init_ce(INIT_FUNC_ARGS)
@@ -458,3 +487,15 @@ void php_phongo_document_init_ce(INIT_FUNC_ARGS)
458487
php_phongo_handler_document.free_obj = php_phongo_document_free_object;
459488
php_phongo_handler_document.offset = XtOffsetOf(php_phongo_document_t, std);
460489
}
490+
491+
bool phongo_document_new(zval* object, bson_t* bson, bool copy)
492+
{
493+
php_phongo_document_t* intern;
494+
495+
object_init_ex(object, php_phongo_document_ce);
496+
497+
intern = Z_DOCUMENT_OBJ_P(object);
498+
intern->bson = copy ? bson_copy(bson) : bson;
499+
500+
return true;
501+
}

src/BSON/Document.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
* Copyright 2023-present MongoDB, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
#ifndef PHONGO_BSON_DOCUMENT_H
18+
#define PHONGO_BSON_DOCUMENT_H
19+
20+
bool phongo_document_new(zval* object, bson_t* bson, bool copy);
21+
22+
#endif /* PHONGO_BSON_DOCUMENT_H */

src/BSON/Document.stub.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,7 @@ final static public function fromPHP(array|object $value): Document {}
2222
final static public function fromPHP($value): Document {}
2323
#endif
2424

25-
#if PHP_VERSION_ID >= 80000
26-
final public function get(string $key): mixed {}
27-
#else
28-
/** @return mixed */
29-
final public function get(string $key) {}
30-
#endif
25+
final public function get(string $key): Value {}
3126

3227
final public function getIterator(): Iterator {}
3328

src/BSON/Document_arginfo.h

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 5994291bf2bfdac1b9d8bad9b96d4f443c2f49aa */
2+
* Stub hash: a5464ed3bb6f730295df4e7945b5d3125b7af437 */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Document___construct, 0, 0, 0)
55
ZEND_END_ARG_INFO()
@@ -24,17 +24,9 @@ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_BSON_Document_fromP
2424
ZEND_END_ARG_INFO()
2525
#endif
2626

27-
#if PHP_VERSION_ID >= 80000
28-
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Document_get, 0, 1, IS_MIXED, 0)
27+
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_BSON_Document_get, 0, 1, MongoDB\\BSON\\Value, 0)
2928
ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
3029
ZEND_END_ARG_INFO()
31-
#endif
32-
33-
#if !(PHP_VERSION_ID >= 80000)
34-
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Document_get, 0, 0, 1)
35-
ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
36-
ZEND_END_ARG_INFO()
37-
#endif
3830

3931
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_BSON_Document_getIterator, 0, 0, MongoDB\\BSON\\Iterator, 0)
4032
ZEND_END_ARG_INFO()
@@ -89,12 +81,7 @@ static ZEND_METHOD(MongoDB_BSON_Document, fromPHP);
8981
#if !(PHP_VERSION_ID >= 80000)
9082
static ZEND_METHOD(MongoDB_BSON_Document, fromPHP);
9183
#endif
92-
#if PHP_VERSION_ID >= 80000
9384
static ZEND_METHOD(MongoDB_BSON_Document, get);
94-
#endif
95-
#if !(PHP_VERSION_ID >= 80000)
96-
static ZEND_METHOD(MongoDB_BSON_Document, get);
97-
#endif
9885
static ZEND_METHOD(MongoDB_BSON_Document, getIterator);
9986
static ZEND_METHOD(MongoDB_BSON_Document, has);
10087
#if PHP_VERSION_ID >= 80000
@@ -123,12 +110,7 @@ static const zend_function_entry class_MongoDB_BSON_Document_methods[] = {
123110
#if !(PHP_VERSION_ID >= 80000)
124111
ZEND_ME(MongoDB_BSON_Document, fromPHP, arginfo_class_MongoDB_BSON_Document_fromPHP, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
125112
#endif
126-
#if PHP_VERSION_ID >= 80000
127-
ZEND_ME(MongoDB_BSON_Document, get, arginfo_class_MongoDB_BSON_Document_get, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
128-
#endif
129-
#if !(PHP_VERSION_ID >= 80000)
130113
ZEND_ME(MongoDB_BSON_Document, get, arginfo_class_MongoDB_BSON_Document_get, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
131-
#endif
132114
ZEND_ME(MongoDB_BSON_Document, getIterator, arginfo_class_MongoDB_BSON_Document_getIterator, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
133115
ZEND_ME(MongoDB_BSON_Document, has, arginfo_class_MongoDB_BSON_Document_has, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
134116
#if PHP_VERSION_ID >= 80000

0 commit comments

Comments
 (0)