mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-10-29 20:59:46 +01:00
php: version 0.3.3
This commit is contained in:
@@ -38,11 +38,15 @@ inline static int msgpack_var_add(
|
||||
+ (long)Z_OBJ_HANDLE_P(var));
|
||||
len = id + sizeof(id) - 1 - p;
|
||||
}
|
||||
else
|
||||
else if (Z_TYPE_P(var) == IS_ARRAY)
|
||||
{
|
||||
p = smart_str_print_long(id + sizeof(id) - 1, (long)var);
|
||||
len = id + sizeof(id) - 1 - p;
|
||||
}
|
||||
else
|
||||
{
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (var_old && zend_hash_find(var_hash, p, len, var_old) == SUCCESS)
|
||||
{
|
||||
@@ -122,10 +126,11 @@ inline static void msgpack_serialize_class(
|
||||
if (MSGPACK_G(error_display))
|
||||
{
|
||||
zend_error(E_NOTICE,
|
||||
"[msgpack] (msgpack_serialize_class) "
|
||||
"[msgpack] (%s) "
|
||||
"__sleep should return an array only "
|
||||
"containing the names of "
|
||||
"instance-variables to serialize.");
|
||||
"instance-variables to serialize.",
|
||||
__FUNCTION__);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
@@ -199,10 +204,10 @@ inline static void msgpack_serialize_class(
|
||||
if (MSGPACK_G(error_display))
|
||||
{
|
||||
zend_error(E_NOTICE,
|
||||
"[msgpack] (msgpack_serialize_class) "
|
||||
"[msgpack] (%s) "
|
||||
"\"%s\" returned as member variable from "
|
||||
"__sleep() but does not exist",
|
||||
Z_STRVAL_PP(name));
|
||||
__FUNCTION__, Z_STRVAL_PP(name));
|
||||
}
|
||||
|
||||
msgpack_serialize_string(
|
||||
@@ -339,8 +344,9 @@ inline static void msgpack_serialize_array(
|
||||
if (MSGPACK_G(error_display))
|
||||
{
|
||||
zend_error(E_WARNING,
|
||||
"[msgpack] (msgpack_serialize_array) "
|
||||
"key is not string nor array");
|
||||
"[msgpack] (%s) "
|
||||
"key is not string nor array",
|
||||
__FUNCTION__);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -361,6 +367,8 @@ inline static void msgpack_serialize_array(
|
||||
Z_ARRVAL_PP(data)->nApplyCount++;
|
||||
}
|
||||
|
||||
//php_var_dump(data, 1 TSRMLS_CC); //hoge
|
||||
|
||||
msgpack_serialize_zval(buf, *data, var_hash TSRMLS_CC);
|
||||
|
||||
if (Z_TYPE_PP(data) == IS_ARRAY)
|
||||
@@ -386,6 +394,7 @@ inline static void msgpack_serialize_object(
|
||||
ce = Z_OBJCE_P(val);
|
||||
}
|
||||
|
||||
#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 0)
|
||||
if (ce && ce->serialize != NULL)
|
||||
{
|
||||
unsigned char *serialized_data = NULL;
|
||||
@@ -418,6 +427,7 @@ inline static void msgpack_serialize_object(
|
||||
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (ce && ce != PHP_IC_ENTRY &&
|
||||
zend_hash_exists(&ce->function_table, "__sleep", sizeof("__sleep")))
|
||||
@@ -441,10 +451,11 @@ inline static void msgpack_serialize_object(
|
||||
if (MSGPACK_G(error_display))
|
||||
{
|
||||
zend_error(E_NOTICE,
|
||||
"[msgpack] (msgpack_serialize_object) "
|
||||
"[msgpack] (%s) "
|
||||
"__sleep should return an array only "
|
||||
"containing the names of instance-variables "
|
||||
"to serialize");
|
||||
"to serialize",
|
||||
__FUNCTION__);
|
||||
}
|
||||
msgpack_pack_nil(buf);
|
||||
}
|
||||
@@ -548,8 +559,8 @@ void msgpack_serialize_zval(
|
||||
if (MSGPACK_G(error_display))
|
||||
{
|
||||
zend_error(E_WARNING,
|
||||
"[msgpack] (php_msgpack_serialize) "
|
||||
"type is unsupported, encoded as null");
|
||||
"[msgpack] (%s) type is unsupported, encoded as null",
|
||||
__FUNCTION__);
|
||||
}
|
||||
msgpack_pack_nil(buf);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user