From 7c4691362163f09f26b792c438181fc52a0bf7b0 Mon Sep 17 00:00:00 2001 From: Pavlo Yatsukhnenko Date: Mon, 12 Jan 2026 19:33:49 +0200 Subject: [PATCH] Fix issue with numeric strings as hash fields --- redis_commands.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/redis_commands.c b/redis_commands.c index 10ebae50ba..a3a4488cbf 100644 --- a/redis_commands.c +++ b/redis_commands.c @@ -2944,14 +2944,19 @@ int redis_hincrbyfloat_cmd(INTERNAL_FUNCTION_PARAMETERS, RedisSock *redis_sock, } static inline zval *coerce_hash_field(zval *zv, zval *aux) { + char buf[32]; zend_long lv; + size_t len; if (UNEXPECTED(Z_TYPE_P(zv) == IS_STRING && is_numeric_string(Z_STRVAL_P(zv), Z_STRLEN_P(zv), &lv, NULL, 0) == IS_LONG)) { - ZVAL_LONG(aux, lv); - return aux; + len = snprintf(buf, sizeof(buf), "%ld", lv); + if (len == Z_STRLEN_P(zv) && redis_strncmp(Z_STRVAL_P(zv), buf, len) == 0) { + ZVAL_LONG(aux, lv); + return aux; + } } return zv;