Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpredis/phpredis.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Favre-Felix <n.favrefelix@gmail.com>2010-09-13 00:46:31 +0400
committerNicolas Favre-Felix <n.favrefelix@gmail.com>2010-09-13 00:46:31 +0400
commit46d5baa8efc5f08390cc7bbf17d77ef63d653f2b (patch)
treea836816f25ac716d07ba80a2d9d8492cec555040 /redis.c
parent4647f0d149d5a913f7b9c73c51e564ad6cca7eb5 (diff)
Fixed HMSET with NULL values, added doc & tests.
Diffstat (limited to 'redis.c')
-rwxr-xr-xredis.c33
1 files changed, 24 insertions, 9 deletions
diff --git a/redis.c b/redis.c
index a2f1c92c..d221b162 100755
--- a/redis.c
+++ b/redis.c
@@ -3937,21 +3937,36 @@ PHP_METHOD(Redis, hMset)
element_count += 2;
/* key is set. */
- if (Z_TYPE_PP(z_value_p) != IS_STRING) {
- convert_to_string(*z_value_p);
- }
- if(*cmd) {
- old_cmd = cmd;
+ zval *z_copy;
+ MAKE_STD_ZVAL(z_copy);
+ switch(Z_TYPE_PP(z_value_p)) {
+
+ case IS_OBJECT:
+ ZVAL_STRINGL(z_copy, "Object", 6, 1);
+ break;
+
+ case IS_ARRAY:
+ ZVAL_STRINGL(z_copy, "Array", 5, 1);
+ break;
+
+ default:
+ *z_copy = **z_value_p;
+ zval_copy_ctor(z_copy);
+ if(Z_TYPE_PP(z_value_p) != IS_STRING) {
+ convert_to_string(z_copy);
+ }
}
+
+ old_cmd = cmd;
cmd_len = redis_cmd_format(&cmd, "%s"
"$%d" _NL "%s" _NL
"$%d" _NL "%s" _NL
, cmd, cmd_len
, hkey_len-1, hkey, hkey_len-1
- , Z_STRLEN_PP(z_value_p), Z_STRVAL_PP(z_value_p), Z_STRLEN_PP(z_value_p));
- if(old_cmd) {
- efree(old_cmd);
- }
+ , Z_STRLEN_P(z_copy), Z_STRVAL_P(z_copy), Z_STRLEN_P(z_copy));
+ efree(old_cmd);
+ zval_dtor(z_copy);
+ efree(z_copy);
}
old_cmd = cmd;