Skip to content

Commit adecfba

Browse files
authored
PHPC-2460: Use zend_zval_type_name instead of internal macros (#1714)
1 parent 20fbbc0 commit adecfba

16 files changed

+50
-53
lines changed

php_phongo.h

-3
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,6 @@ zend_object_handlers* phongo_get_std_object_handlers(void);
8282
} \
8383
} while (0)
8484

85-
#define PHONGO_ZVAL_CLASS_OR_TYPE_NAME(zv) (Z_TYPE(zv) == IS_OBJECT ? ZSTR_VAL(Z_OBJCE(zv)->name) : zend_get_type_by_const(Z_TYPE(zv)))
86-
#define PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(zvp) PHONGO_ZVAL_CLASS_OR_TYPE_NAME(*(zvp))
87-
8885
#define PHONGO_ZVAL_EXCEPTION_NAME(e) (ZSTR_VAL(e->ce->name))
8986

9087
#define PHONGO_SET_CREATED_BY_PID(intern) \

src/BSON/Document.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ static PHP_METHOD(MongoDB_BSON_Document, offsetGet)
328328
intern = Z_DOCUMENT_OBJ_P(getThis());
329329

330330
if (Z_TYPE_P(offset) != IS_STRING) {
331-
phongo_throw_exception(PHONGO_ERROR_RUNTIME, "Could not find key of type \"%s\" in BSON document", PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(offset));
331+
phongo_throw_exception(PHONGO_ERROR_RUNTIME, "Could not find key of type \"%s\" in BSON document", zend_zval_type_name(offset));
332332
return;
333333
}
334334

@@ -598,7 +598,7 @@ zval* php_phongo_document_read_dimension(zend_object* object, zval* offset, int
598598
return rv;
599599
}
600600

601-
phongo_throw_exception(PHONGO_ERROR_RUNTIME, "Could not find key of type \"%s\" in BSON document", PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(offset));
601+
phongo_throw_exception(PHONGO_ERROR_RUNTIME, "Could not find key of type \"%s\" in BSON document", zend_zval_type_name(offset));
602602
return &EG(uninitialized_zval);
603603
}
604604

src/BSON/Int64.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ static PHP_METHOD(MongoDB_BSON_Int64, __construct)
103103
} else if (Z_TYPE_P(value) == IS_LONG) {
104104
php_phongo_int64_init(intern, Z_LVAL_P(value));
105105
} else {
106-
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected value to be integer or string, %s given", PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(value));
106+
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected value to be integer or string, %s given", zend_zval_type_name(value));
107107
}
108108
}
109109

src/BSON/Iterator.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@ static bool php_phongo_iterator_init_with_zval(php_phongo_iterator_t* iterator,
5454
bson = php_phongo_iterator_get_bson_from_zval(zbson);
5555
if (!bson) {
5656
/* Should never happen, but if it does: exception */
57-
phongo_throw_exception(PHONGO_ERROR_LOGIC, "Could not create iterator for %s instance", PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(zbson));
57+
phongo_throw_exception(PHONGO_ERROR_LOGIC, "Could not create iterator for %s instance", zend_zval_type_name(zbson));
5858

5959
return false;
6060
}
6161

6262
if (!bson_iter_init(&iterator->iter, bson)) {
63-
phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "Could not create iterator for %s instance", PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(zbson));
63+
phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "Could not create iterator for %s instance", zend_zval_type_name(zbson));
6464

6565
return false;
6666
}

src/BSON/PackedArray.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ static PHP_METHOD(MongoDB_BSON_PackedArray, offsetGet)
354354
intern = Z_PACKEDARRAY_OBJ_P(getThis());
355355

356356
if (Z_TYPE_P(key) != IS_LONG) {
357-
phongo_throw_exception(PHONGO_ERROR_RUNTIME, "Could not find index of type \"%s\" in BSON array", PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(key));
357+
phongo_throw_exception(PHONGO_ERROR_RUNTIME, "Could not find index of type \"%s\" in BSON array", zend_zval_type_name(key));
358358
return;
359359
}
360360

@@ -587,7 +587,7 @@ zval* php_phongo_packedarray_read_dimension(zend_object* object, zval* offset, i
587587
return rv;
588588
}
589589

590-
phongo_throw_exception(PHONGO_ERROR_RUNTIME, "Could not find index of type \"%s\" in BSON array", PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(offset));
590+
phongo_throw_exception(PHONGO_ERROR_RUNTIME, "Could not find index of type \"%s\" in BSON array", zend_zval_type_name(offset));
591591
return &EG(uninitialized_zval);
592592
}
593593

src/BSON/Timestamp.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ static PHP_METHOD(MongoDB_BSON_Timestamp, __construct)
144144
}
145145

146146
if (Z_TYPE_P(increment) != IS_STRING) {
147-
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected increment to be an unsigned 32-bit integer or string, %s given", PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(increment));
147+
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected increment to be an unsigned 32-bit integer or string, %s given", zend_zval_type_name(increment));
148148
return;
149149
}
150150

@@ -153,7 +153,7 @@ static PHP_METHOD(MongoDB_BSON_Timestamp, __construct)
153153
}
154154

155155
if (Z_TYPE_P(timestamp) != IS_STRING) {
156-
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected timestamp to be an unsigned 32-bit integer or string, %s given", PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(timestamp));
156+
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected timestamp to be an unsigned 32-bit integer or string, %s given", zend_zval_type_name(timestamp));
157157
return;
158158
}
159159

src/BSON/UTCDateTime.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ static PHP_METHOD(MongoDB_BSON_UTCDateTime, __construct)
230230
return;
231231
}
232232

233-
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected integer or string, %s given", PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(milliseconds));
233+
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected integer or string, %s given", zend_zval_type_name(milliseconds));
234234
}
235235

236236
static PHP_METHOD(MongoDB_BSON_UTCDateTime, __set_state)

src/MongoDB/ClientEncryption.c

+9-9
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ static PHP_METHOD(MongoDB_Driver_ClientEncryption, rewrapManyDataKey)
429429
zval* zmasterkey = php_array_fetchc_deref(options, "masterKey");
430430

431431
if (Z_TYPE_P(zmasterkey) != IS_OBJECT && Z_TYPE_P(zmasterkey) != IS_ARRAY) {
432-
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"masterKey\" option to be array or object, %s given", PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(zmasterkey));
432+
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"masterKey\" option to be array or object, %s given", zend_zval_type_name(zmasterkey));
433433
goto cleanup;
434434
}
435435

@@ -552,7 +552,7 @@ static mongoc_client_encryption_opts_t* phongo_clientencryption_opts_from_zval(z
552552
zval* key_vault_client = php_array_fetchc_deref(options, "keyVaultClient");
553553

554554
if (Z_TYPE_P(key_vault_client) != IS_OBJECT || !instanceof_function(Z_OBJCE_P(key_vault_client), php_phongo_manager_ce)) {
555-
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"keyVaultClient\" option to be %s, %s given", ZSTR_VAL(php_phongo_manager_ce->name), PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(key_vault_client));
555+
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"keyVaultClient\" option to be %s, %s given", ZSTR_VAL(php_phongo_manager_ce->name), zend_zval_type_name(key_vault_client));
556556
goto cleanup;
557557
}
558558

@@ -601,7 +601,7 @@ static mongoc_client_encryption_opts_t* phongo_clientencryption_opts_from_zval(z
601601
bson_t bson_providers = BSON_INITIALIZER;
602602

603603
if (Z_TYPE_P(kms_providers) != IS_ARRAY && Z_TYPE_P(kms_providers) != IS_OBJECT) {
604-
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"kmsProviders\" option to be an array or object, %s given", PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(kms_providers));
604+
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"kmsProviders\" option to be an array or object, %s given", zend_zval_type_name(kms_providers));
605605
goto cleanup;
606606
}
607607

@@ -619,7 +619,7 @@ static mongoc_client_encryption_opts_t* phongo_clientencryption_opts_from_zval(z
619619
bson_t bson_options = BSON_INITIALIZER;
620620

621621
if (Z_TYPE_P(tls_options) != IS_ARRAY && Z_TYPE_P(tls_options) != IS_OBJECT) {
622-
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"tlsOptions\" option to be an array or object, %s given", PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(tls_options));
622+
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"tlsOptions\" option to be an array or object, %s given", zend_zval_type_name(tls_options));
623623
goto cleanup;
624624
}
625625

@@ -715,7 +715,7 @@ static mongoc_client_encryption_datakey_opts_t* phongo_clientencryption_datakey_
715715
bool failed = false;
716716

717717
if (!zkeyaltnames || Z_TYPE_P(zkeyaltnames) != IS_ARRAY) {
718-
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected keyAltNames to be array, %s given", PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(zkeyaltnames));
718+
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected keyAltNames to be array, %s given", zend_zval_type_name(zkeyaltnames));
719719
goto cleanup;
720720
}
721721

@@ -738,9 +738,9 @@ static mongoc_client_encryption_datakey_opts_t* phongo_clientencryption_datakey_
738738

739739
if (Z_TYPE_P(keyaltname) != IS_STRING) {
740740
if (string_key) {
741-
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected keyAltName with index \"%s\" to be string, %s given", ZSTR_VAL(string_key), PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(keyaltname));
741+
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected keyAltName with index \"%s\" to be string, %s given", ZSTR_VAL(string_key), zend_zval_type_name(keyaltname));
742742
} else {
743-
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected keyAltName with index \"%lu\" to be string, %s given", num_key, PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(keyaltname));
743+
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected keyAltName with index \"%lu\" to be string, %s given", num_key, zend_zval_type_name(keyaltname));
744744
}
745745

746746
failed = true;
@@ -771,7 +771,7 @@ static mongoc_client_encryption_datakey_opts_t* phongo_clientencryption_datakey_
771771
zval* keyMaterial = php_array_fetchc_deref(options, "keyMaterial");
772772

773773
if (Z_TYPE_P(keyMaterial) != IS_OBJECT || !instanceof_function(Z_OBJCE_P(keyMaterial), php_phongo_binary_ce)) {
774-
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"keyMaterial\" option to be %s, %s given", ZSTR_VAL(php_phongo_binary_ce->name), PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(keyMaterial));
774+
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"keyMaterial\" option to be %s, %s given", ZSTR_VAL(php_phongo_binary_ce->name), zend_zval_type_name(keyMaterial));
775775
goto cleanup;
776776
}
777777

@@ -783,7 +783,7 @@ static mongoc_client_encryption_datakey_opts_t* phongo_clientencryption_datakey_
783783
bson_t masterkey = BSON_INITIALIZER;
784784

785785
if (Z_TYPE_P(zmasterkey) != IS_OBJECT && Z_TYPE_P(zmasterkey) != IS_ARRAY) {
786-
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"masterKey\" option to be array or object, %s given", PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(zmasterkey));
786+
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"masterKey\" option to be array or object, %s given", zend_zval_type_name(zmasterkey));
787787
goto cleanup;
788788
}
789789

src/MongoDB/Manager.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,7 @@ static PHP_METHOD(MongoDB_Driver_Manager, startSession)
741741
phongo_throw_exception(
742742
PHONGO_ERROR_INVALID_ARGUMENT,
743743
"Expected \"defaultTransactionOptions\" option to be an array, %s given",
744-
PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(txn_options));
744+
zend_zval_type_name(txn_options));
745745
goto cleanup;
746746
}
747747

src/MongoDB/Query.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ static bool php_phongo_query_opts_append_string(bson_t* opts, const char* opts_k
3939
zval* value = php_array_fetch_deref(zarr, zarr_key);
4040

4141
if (Z_TYPE_P(value) != IS_STRING) {
42-
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"%s\" %s to be string, %s given", zarr_key, zarr_key[0] == '$' ? "modifier" : "option", PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(value));
42+
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"%s\" %s to be string, %s given", zarr_key, zarr_key[0] == '$' ? "modifier" : "option", zend_zval_type_name(value));
4343
return false;
4444
}
4545

@@ -59,7 +59,7 @@ static bool php_phongo_query_opts_append_document(bson_t* opts, const char* opts
5959
bson_t b = BSON_INITIALIZER;
6060

6161
if (Z_TYPE_P(value) != IS_OBJECT && Z_TYPE_P(value) != IS_ARRAY) {
62-
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"%s\" %s to be array or object, %s given", zarr_key, zarr_key[0] == '$' ? "modifier" : "option", PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(value));
62+
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"%s\" %s to be array or object, %s given", zarr_key, zarr_key[0] == '$' ? "modifier" : "option", zend_zval_type_name(value));
6363
return false;
6464
}
6565

@@ -249,7 +249,7 @@ static bool php_phongo_query_init_readconcern(php_phongo_query_t* intern, zval*
249249
read_concern = php_array_fetchc_deref(options, "readConcern");
250250

251251
if (Z_TYPE_P(read_concern) != IS_OBJECT || !instanceof_function(Z_OBJCE_P(read_concern), php_phongo_readconcern_ce)) {
252-
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"readConcern\" option to be %s, %s given", ZSTR_VAL(php_phongo_readconcern_ce->name), PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(read_concern));
252+
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"readConcern\" option to be %s, %s given", ZSTR_VAL(php_phongo_readconcern_ce->name), zend_zval_type_name(read_concern));
253253
return false;
254254
}
255255

@@ -303,7 +303,7 @@ bool phongo_query_init(zval* return_value, zval* filter, zval* options)
303303
}
304304

305305
if (Z_TYPE_P(return_value) != IS_OBJECT || !instanceof_function(Z_OBJCE_P(return_value), php_phongo_query_ce)) {
306-
phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "Expected initialization object to be %s, %s given", ZSTR_VAL(php_phongo_query_ce->name), PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(return_value));
306+
phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "Expected initialization object to be %s, %s given", ZSTR_VAL(php_phongo_query_ce->name), zend_zval_type_name(return_value));
307307
return false;
308308
}
309309

@@ -336,7 +336,7 @@ bool phongo_query_init(zval* return_value, zval* filter, zval* options)
336336
modifiers = php_array_fetchc_deref(options, "modifiers");
337337

338338
if (Z_TYPE_P(modifiers) != IS_ARRAY) {
339-
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"modifiers\" option to be array, %s given", PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(modifiers));
339+
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"modifiers\" option to be array, %s given", zend_zval_type_name(modifiers));
340340
return false;
341341
}
342342

src/MongoDB/ReadPreference.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ static PHP_METHOD(MongoDB_Driver_ReadPreference, __construct)
225225
return;
226226
}
227227
} else {
228-
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected mode to be integer or string, %s given", PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(mode));
228+
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected mode to be integer or string, %s given", zend_zval_type_name(mode));
229229
return;
230230
}
231231

src/MongoDB/Session.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ mongoc_transaction_opt_t* php_mongodb_session_parse_transaction_options(zval* op
381381
zval* read_concern = php_array_fetchc_deref(options, "readConcern");
382382

383383
if (Z_TYPE_P(read_concern) != IS_OBJECT || !instanceof_function(Z_OBJCE_P(read_concern), php_phongo_readconcern_ce)) {
384-
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"readConcern\" option to be %s, %s given", ZSTR_VAL(php_phongo_readconcern_ce->name), PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(read_concern));
384+
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"readConcern\" option to be %s, %s given", ZSTR_VAL(php_phongo_readconcern_ce->name), zend_zval_type_name(read_concern));
385385
if (opts) {
386386
mongoc_transaction_opts_destroy(opts);
387387
}
@@ -399,7 +399,7 @@ mongoc_transaction_opt_t* php_mongodb_session_parse_transaction_options(zval* op
399399
zval* read_preference = php_array_fetchc_deref(options, "readPreference");
400400

401401
if (Z_TYPE_P(read_preference) != IS_OBJECT || !instanceof_function(Z_OBJCE_P(read_preference), php_phongo_readpreference_ce)) {
402-
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"readPreference\" option to be %s, %s given", ZSTR_VAL(php_phongo_readpreference_ce->name), PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(read_preference));
402+
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"readPreference\" option to be %s, %s given", ZSTR_VAL(php_phongo_readpreference_ce->name), zend_zval_type_name(read_preference));
403403
if (opts) {
404404
mongoc_transaction_opts_destroy(opts);
405405
}
@@ -417,7 +417,7 @@ mongoc_transaction_opt_t* php_mongodb_session_parse_transaction_options(zval* op
417417
zval* write_concern = php_array_fetchc_deref(options, "writeConcern");
418418

419419
if (Z_TYPE_P(write_concern) != IS_OBJECT || !instanceof_function(Z_OBJCE_P(write_concern), php_phongo_writeconcern_ce)) {
420-
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"writeConcern\" option to be %s, %s given", ZSTR_VAL(php_phongo_writeconcern_ce->name), PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(write_concern));
420+
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"writeConcern\" option to be %s, %s given", ZSTR_VAL(php_phongo_writeconcern_ce->name), zend_zval_type_name(write_concern));
421421
if (opts) {
422422
mongoc_transaction_opts_destroy(opts);
423423
}

src/MongoDB/WriteConcern.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ static PHP_METHOD(MongoDB_Driver_WriteConcern, __construct)
138138
mongoc_write_concern_set_wtag(intern->write_concern, Z_STRVAL_P(w));
139139
}
140140
} else {
141-
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected w to be integer or string, %s given", PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(w));
141+
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected w to be integer or string, %s given", zend_zval_type_name(w));
142142
return;
143143
}
144144

src/phongo_bson_encode.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ static inline bool phongo_check_bson_serialize_return_type(zval* retval, zend_cl
104104
ZSTR_VAL(ce->name),
105105
BSON_SERIALIZE_FUNC_NAME,
106106
ZSTR_VAL(php_phongo_document_ce->name),
107-
PHONGO_ZVAL_CLASS_OR_TYPE_NAME(*retval));
107+
zend_zval_type_name(retval));
108108
return false;
109109
}
110110

@@ -121,7 +121,7 @@ static inline bool phongo_check_bson_serialize_return_type(zval* retval, zend_cl
121121
BSON_SERIALIZE_FUNC_NAME,
122122
ZSTR_VAL(php_phongo_document_ce->name),
123123
ZSTR_VAL(php_phongo_packedarray_ce->name),
124-
PHONGO_ZVAL_CLASS_OR_TYPE_NAME(*retval));
124+
zend_zval_type_name(retval));
125125
return false;
126126
}
127127

0 commit comments

Comments
 (0)