mirror of
https://github.com/php-win-ext/phpredis.git
synced 2026-03-24 00:52:16 +01:00
Fix errors and a warning
* PHP < 8.0 took a `char*` as `php_json_decode` input, whereas newer versions take a const char * so ifdef around this. * Fix compilation errors due to `false` not being defined. So as to make a minimal change we can just use 0 and 1
This commit is contained in:
committed by
Michael Grunder
parent
92dd256f98
commit
b8de91c9e0
12
library.c
12
library.c
@@ -2686,14 +2686,22 @@ fail:
|
||||
PHP_REDIS_API int
|
||||
redis_deserialize_vgetattr_reply(zval *zret, const char *str, size_t len) {
|
||||
#ifdef HAVE_REDIS_JSON
|
||||
if (php_json_decode(zret, str, len, 1, PHP_JSON_PARSER_DEFAULT_DEPTH)
|
||||
== FAILURE)
|
||||
#if PHP_VERSION_ID < 80000
|
||||
#define PHP_JSON_IN(s) ((char*)s)
|
||||
#else
|
||||
#define PHP_JSON_IN(s) (s)
|
||||
#endif
|
||||
|
||||
if (php_json_decode(zret, PHP_JSON_IN(str), len, 1,
|
||||
PHP_JSON_PARSER_DEFAULT_DEPTH) == FAILURE)
|
||||
{
|
||||
php_error_docref(NULL, E_WARNING, "Failed to deserialize attributes");
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
|
||||
#undef PHP_JSON_IN
|
||||
#else
|
||||
php_error_docref(NULL, E_WARNING,
|
||||
"PhpRedis is not compiled with JSON support");
|
||||
|
||||
@@ -7043,8 +7043,8 @@ int
|
||||
redis_vlinks_cmd(INTERNAL_FUNCTION_PARAMETERS, RedisSock *redis_sock,
|
||||
char **cmd, int *cmd_len, short *slot, void **ctx)
|
||||
{
|
||||
zend_bool withscores = false;
|
||||
smart_string cmdstr = {0};
|
||||
zend_bool withscores = 0;
|
||||
zend_string *key;
|
||||
zval *member;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user