@@ -725,11 +725,11 @@ static void simdjson_encode_base64_object(smart_str *buf, const zval *val) {
725
725
726
726
static zend_result simdjson_encode_serializable_object (smart_str *buf, zval *val, simdjson_encoder *encoder) {
727
727
zend_class_entry *ce = Z_OBJCE_P (val);
728
+ zend_object *obj = Z_OBJ_P (val);
728
729
zval retval;
729
730
zend_result return_code;
730
731
731
732
#if PHP_VERSION_ID >= 80300
732
- zend_object *obj = Z_OBJ_P (val);
733
733
uint32_t *guard = zend_get_recursion_guard (obj);
734
734
ZEND_ASSERT (guard != NULL );
735
735
@@ -752,7 +752,7 @@ static zend_result simdjson_encode_serializable_object(smart_str *buf, zval *val
752
752
753
753
zend_function *json_serialize_method = (zend_function*)zend_hash_find_ex_ptr (&ce->function_table , simdjson_json_serialize, 1 );
754
754
ZEND_ASSERT (json_serialize_method != NULL && " This should be guaranteed prior to calling this function" );
755
- zend_call_known_instance_method_with_0_params (json_serialize_method, Z_OBJ_P (val) , &retval);
755
+ zend_call_known_instance_method_with_0_params (json_serialize_method, obj , &retval);
756
756
/* An exception has occurred */
757
757
if (Z_TYPE (retval) == IS_UNDEF) {
758
758
#if PHP_VERSION_ID >= 80300
@@ -763,8 +763,7 @@ static zend_result simdjson_encode_serializable_object(smart_str *buf, zval *val
763
763
return FAILURE;
764
764
}
765
765
766
- /* An exception has occurred */
767
- if (Z_TYPE (retval) == IS_OBJECT && Z_OBJ (retval) == Z_OBJ_P (val)) {
766
+ if (Z_TYPE (retval) == IS_OBJECT && Z_OBJ (retval) == obj) {
768
767
/* Handle the case where jsonSerialize does: return $this; by going straight to encode array */
769
768
#if PHP_VERSION_ID >= 80300
770
769
ZEND_GUARD_UNPROTECT_RECURSION (guard, JSON);
0 commit comments