Skip to content

Commit bde2b37

Browse files
committed
Cleanup
1 parent 1ab1886 commit bde2b37

20 files changed

+35
-41
lines changed

src/BSON/Binary.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ static HashTable* php_phongo_binary_get_properties_hash(zend_object* object)
7070

7171
intern = Z_OBJ_BINARY(object);
7272

73-
props = zend_std_get_properties(object);
73+
props = zend_array_dup(zend_std_get_properties(object));
7474

7575
if (!intern->data) {
7676
return props;
@@ -186,7 +186,7 @@ static PHP_METHOD(MongoDB_BSON_Binary, __serialize)
186186
{
187187
PHONGO_PARSE_PARAMETERS_NONE();
188188

189-
PHONGO_RETURN_PROPERTIES_ARR(php_phongo_binary_get_properties_hash(Z_OBJ_P(getThis())));
189+
RETURN_ARR(php_phongo_binary_get_properties_hash(Z_OBJ_P(getThis())));
190190
}
191191

192192
static PHP_METHOD(MongoDB_BSON_Binary, __unserialize)

src/BSON/DBPointer.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ HashTable* php_phongo_dbpointer_get_properties_hash(zend_object* object)
7171

7272
intern = Z_OBJ_DBPOINTER(object);
7373

74-
props = zend_std_get_properties(object);
74+
props = zend_array_dup(zend_std_get_properties(object));
7575

7676
if (!intern->ref) {
7777
return props;
@@ -149,7 +149,7 @@ static PHP_METHOD(MongoDB_BSON_DBPointer, __serialize)
149149
{
150150
PHONGO_PARSE_PARAMETERS_NONE();
151151

152-
PHONGO_RETURN_PROPERTIES_ARR(php_phongo_dbpointer_get_properties_hash(Z_OBJ_P(getThis())));
152+
RETURN_ARR(php_phongo_dbpointer_get_properties_hash(Z_OBJ_P(getThis())));
153153
}
154154

155155
static PHP_METHOD(MongoDB_BSON_DBPointer, __unserialize)

src/BSON/Decimal128.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ static HashTable* php_phongo_decimal128_get_properties_hash(zend_object* object)
6161

6262
intern = Z_OBJ_DECIMAL128(object);
6363

64-
props = zend_std_get_properties(object);
64+
props = zend_array_dup(zend_std_get_properties(object));
6565

6666
if (!intern->initialized) {
6767
return props;
@@ -145,7 +145,7 @@ static PHP_METHOD(MongoDB_BSON_Decimal128, __serialize)
145145
{
146146
PHONGO_PARSE_PARAMETERS_NONE();
147147

148-
PHONGO_RETURN_PROPERTIES_ARR(php_phongo_decimal128_get_properties_hash(Z_OBJ_P(getThis())));
148+
RETURN_ARR(php_phongo_decimal128_get_properties_hash(Z_OBJ_P(getThis())));
149149
}
150150

151151
static PHP_METHOD(MongoDB_BSON_Decimal128, __unserialize)

src/BSON/Document.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ static HashTable* php_phongo_document_get_properties_hash(zend_object* object, i
6262

6363
intern = Z_OBJ_DOCUMENT(object);
6464

65-
props = zend_std_get_properties(object);
65+
props = zend_array_dup(zend_std_get_properties(object));
6666

6767
if (!intern->bson) {
6868
return props;
@@ -419,7 +419,7 @@ static PHP_METHOD(MongoDB_BSON_Document, __serialize)
419419
{
420420
PHONGO_PARSE_PARAMETERS_NONE();
421421

422-
PHONGO_RETURN_PROPERTIES_ARR(php_phongo_document_get_properties_hash(Z_OBJ_P(getThis()), 1));
422+
RETURN_ARR(php_phongo_document_get_properties_hash(Z_OBJ_P(getThis()), 1));
423423
}
424424

425425
static PHP_METHOD(MongoDB_BSON_Document, __unserialize)

src/BSON/Int64.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ HashTable* php_phongo_int64_get_properties_hash(zend_object* object)
6969

7070
intern = Z_OBJ_INT64(object);
7171

72-
props = zend_std_get_properties(object);
72+
props = zend_array_dup(zend_std_get_properties(object));
7373

7474
if (!intern->initialized) {
7575
return props;
@@ -152,7 +152,7 @@ static PHP_METHOD(MongoDB_BSON_Int64, __serialize)
152152
{
153153
PHONGO_PARSE_PARAMETERS_NONE();
154154

155-
PHONGO_RETURN_PROPERTIES_ARR(php_phongo_int64_get_properties_hash(Z_OBJ_P(getThis())));
155+
RETURN_ARR(php_phongo_int64_get_properties_hash(Z_OBJ_P(getThis())));
156156
}
157157

158158
static PHP_METHOD(MongoDB_BSON_Int64, __unserialize)

src/BSON/Iterator.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ static HashTable* php_phongo_iterator_get_properties_hash(zend_object* object)
160160

161161
intern = Z_OBJ_ITERATOR(object);
162162

163-
props = zend_std_get_properties(object);
163+
props = zend_array_dup(zend_std_get_properties(object));
164164

165165
zend_hash_str_update(props, "bson", sizeof("bson") - 1, &intern->bson);
166166
Z_TRY_ADDREF(intern->bson);

src/BSON/Javascript.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ HashTable* php_phongo_javascript_get_properties_hash(zend_object* object)
7676

7777
intern = Z_OBJ_JAVASCRIPT(object);
7878

79-
props = zend_std_get_properties(object);
79+
props = zend_array_dup(zend_std_get_properties(object));
8080

8181
if (!intern->code) {
8282
return props;
@@ -227,7 +227,7 @@ static PHP_METHOD(MongoDB_BSON_Javascript, __serialize)
227227
{
228228
PHONGO_PARSE_PARAMETERS_NONE();
229229

230-
PHONGO_RETURN_PROPERTIES_ARR(php_phongo_javascript_get_properties_hash(Z_OBJ_P(getThis())));
230+
RETURN_ARR(php_phongo_javascript_get_properties_hash(Z_OBJ_P(getThis())));
231231
}
232232

233233
static PHP_METHOD(MongoDB_BSON_Javascript, __unserialize)

src/BSON/ObjectId.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ static HashTable* php_phongo_objectid_get_properties_hash(zend_object* object)
8484

8585
intern = Z_OBJ_OBJECTID(object);
8686

87-
props = zend_std_get_properties(object);
87+
props = zend_array_dup(zend_std_get_properties(object));
88+
GC_SET_REFCOUNT(props, 0);
8889

8990
if (!intern->initialized) {
9091
return props;
@@ -179,7 +180,7 @@ static PHP_METHOD(MongoDB_BSON_ObjectId, __serialize)
179180
{
180181
PHONGO_PARSE_PARAMETERS_NONE();
181182

182-
PHONGO_RETURN_PROPERTIES_ARR(php_phongo_objectid_get_properties_hash(Z_OBJ_P(getThis())));
183+
RETURN_ARR(php_phongo_objectid_get_properties_hash(Z_OBJ_P(getThis())));
183184
}
184185

185186
static PHP_METHOD(MongoDB_BSON_ObjectId, __unserialize)

src/BSON/PackedArray.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ static HashTable* php_phongo_packedarray_get_properties_hash(zend_object* object
6363

6464
intern = Z_OBJ_PACKEDARRAY(object);
6565

66-
props = zend_std_get_properties(object);
66+
props = zend_array_dup(zend_std_get_properties(object));
6767

6868
if (!intern->bson) {
6969
return props;
@@ -403,7 +403,7 @@ static PHP_METHOD(MongoDB_BSON_PackedArray, __serialize)
403403
{
404404
PHONGO_PARSE_PARAMETERS_NONE();
405405

406-
PHONGO_RETURN_PROPERTIES_ARR(php_phongo_packedarray_get_properties_hash(Z_OBJ_P(getThis()), 1));
406+
RETURN_ARR(php_phongo_packedarray_get_properties_hash(Z_OBJ_P(getThis()), 1));
407407
}
408408

409409
static PHP_METHOD(MongoDB_BSON_PackedArray, __unserialize)

src/BSON/Regex.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ static HashTable* php_phongo_regex_get_properties_hash(zend_object* object)
8585

8686
intern = Z_OBJ_REGEX(object);
8787

88-
props = zend_std_get_properties(object);
88+
props = zend_array_dup(zend_std_get_properties(object));
8989

9090
if (!intern->pattern) {
9191
return props;
@@ -197,7 +197,7 @@ static PHP_METHOD(MongoDB_BSON_Regex, __serialize)
197197
{
198198
PHONGO_PARSE_PARAMETERS_NONE();
199199

200-
PHONGO_RETURN_PROPERTIES_ARR(php_phongo_regex_get_properties_hash(Z_OBJ_P(getThis())));
200+
RETURN_ARR(php_phongo_regex_get_properties_hash(Z_OBJ_P(getThis())));
201201
}
202202

203203
static PHP_METHOD(MongoDB_BSON_Regex, __unserialize)

0 commit comments

Comments
 (0)