Skip to content

Commit a609f23

Browse files
committed
fix
isset bug
1 parent 8afd186 commit a609f23

File tree

1 file changed

+36
-36
lines changed

1 file changed

+36
-36
lines changed

msgpack7/swoole_serialize.c

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ static CPINLINE void swoole_check_size(seriaString *str, size_t len)
6262
// int new_size = len + str->offset + 3 + sizeof (zend_ulong); //space 1 for the type and 2 for key string len or index len and(zend_ulong) for key h
6363
if (str->total < new_size)
6464
{//extend it
65-
65+
6666
//double size
6767
new_size = ZEND_MM_ALIGNED_SIZE(new_size + new_size);
6868
str->buffer = erealloc2(str->buffer, new_size, str->offset);
@@ -204,19 +204,19 @@ static void* swoole_unserialize_arr(void *buffer, zval *zvalue, uint32_t nNumOfE
204204

205205
GC_REFCOUNT(ht) = 1;
206206
GC_TYPE_INFO(ht) = IS_ARRAY;
207-
if (ht->nNumUsed)
207+
// if (ht->nNumUsed)
208+
// {
209+
// void *arData = ecalloc(1, len);
210+
HT_SET_DATA_ADDR(ht, emalloc(HT_SIZE(ht)));
211+
ht->u.flags |= HASH_FLAG_INITIALIZED;
212+
int ht_hash_size = HT_HASH_SIZE((ht)->nTableMask);
213+
if (ht_hash_size <= 0)
208214
{
209-
// void *arData = ecalloc(1, len);
210-
HT_SET_DATA_ADDR(ht, emalloc(HT_SIZE(ht)));
211-
ht->u.flags |= HASH_FLAG_INITIALIZED;
212-
int ht_hash_size = HT_HASH_SIZE((ht)->nTableMask);
213-
if (ht_hash_size <= 0)
214-
{
215-
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "illegal unserialize data");
216-
return NULL;
217-
}
218-
HT_HASH_RESET(ht);
215+
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "illegal unserialize data");
216+
return NULL;
219217
}
218+
HT_HASH_RESET(ht);
219+
// }
220220

221221

222222
int idx;
@@ -768,30 +768,30 @@ static void* swoole_unserialize_object(void *buffer, zval *return_value, zend_uc
768768

769769
if (ce->constructor)
770770
{
771-
// zend_fcall_info fci = {0};
772-
// zend_fcall_info_cache fcc = {0};
773-
// fci.size = sizeof (zend_fcall_info);
774-
// zval retval;
775-
// ZVAL_UNDEF(&fci.function_name);
776-
// fci.retval = &retval;
777-
// fci.param_count = 0;
778-
// fci.params = NULL;
779-
// fci.no_separation = 1;
780-
// fci.object = Z_OBJ_P(return_value);
781-
//
782-
// zend_fcall_info_args_ex(&fci, ce->constructor, args);
783-
//
784-
// fcc.initialized = 1;
785-
// fcc.function_handler = ce->constructor;
786-
// // fcc.calling_scope = EG(scope);
787-
// fcc.called_scope = Z_OBJCE_P(return_value);
788-
// fcc.object = Z_OBJ_P(return_value);
789-
//
790-
// if (zend_call_function(&fci, &fcc) == FAILURE)
791-
// {
792-
// zend_throw_exception_ex(NULL, 0, "could not call class constructor");
793-
// }
794-
// zend_fcall_info_args_clear(&fci, 1);
771+
// zend_fcall_info fci = {0};
772+
// zend_fcall_info_cache fcc = {0};
773+
// fci.size = sizeof (zend_fcall_info);
774+
// zval retval;
775+
// ZVAL_UNDEF(&fci.function_name);
776+
// fci.retval = &retval;
777+
// fci.param_count = 0;
778+
// fci.params = NULL;
779+
// fci.no_separation = 1;
780+
// fci.object = Z_OBJ_P(return_value);
781+
//
782+
// zend_fcall_info_args_ex(&fci, ce->constructor, args);
783+
//
784+
// fcc.initialized = 1;
785+
// fcc.function_handler = ce->constructor;
786+
// // fcc.calling_scope = EG(scope);
787+
// fcc.called_scope = Z_OBJCE_P(return_value);
788+
// fcc.object = Z_OBJ_P(return_value);
789+
//
790+
// if (zend_call_function(&fci, &fcc) == FAILURE)
791+
// {
792+
// zend_throw_exception_ex(NULL, 0, "could not call class constructor");
793+
// }
794+
// zend_fcall_info_args_clear(&fci, 1);
795795
}
796796

797797

0 commit comments

Comments
 (0)