Skip to content

Commit f26b44f

Browse files
bjoriderickr
authored andcommitted
Use Z_ISUNDEF() to check the zval
1 parent c6a871a commit f26b44f

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/bson.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,7 +1062,7 @@ PHONGO_API void zval_to_bson(zval *data, php_phongo_bson_flags_t flags, bson_t *
10621062
}
10631063

10641064
if (!ht_data || ZEND_HASH_APPLY_COUNT(ht_data) > 1) {
1065-
if (obj_data) {
1065+
if (!Z_ISUNDEF(obj_data)) {
10661066
zval_ptr_dtor(&obj_data);
10671067
}
10681068
return;
@@ -1146,10 +1146,8 @@ PHONGO_API void zval_to_bson(zval *data, php_phongo_bson_flags_t flags, bson_t *
11461146
}
11471147
}
11481148
}
1149-
if (obj_data) {
1150-
#if PHP_VERSION_ID >= 70000
1151-
zval_ptr_dtor(obj_data);
1152-
#else
1149+
if (!Z_ISUNDEF(obj_data)) {
1150+
#if PHP_VERSION_ID < 70000
11531151
zval_ptr_dtor(&obj_data);
11541152
#endif
11551153
}

0 commit comments

Comments
 (0)