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:
authormichael-grunder <michael.grunder@gmail.com>2019-05-15 22:38:11 +0300
committerMichael Grunder <michael.grunder@gmail.com>2019-05-16 19:19:37 +0300
commit60223762ada628c26cb82386bed281e4ec097f4f (patch)
treea79aff3ec5387a38a9d0c51ebd1a3646b14c85d0 /redis.c
parent4f352059433215072e856b004e1edd69920381d6 (diff)
Allow persistent_id to be passed as NULL with strict_types enabled.
Right now it is not possible to pass NULL as the persistent_id if strict types are enabled. This change allows the argument to be NULL. Addresses issue #1551
Diffstat (limited to 'redis.c')
-rw-r--r--redis.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/redis.c b/redis.c
index 05a283da..1a11997c 100644
--- a/redis.c
+++ b/redis.c
@@ -906,7 +906,7 @@ PHP_REDIS_API int
redis_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
{
zval *object;
- char *host = NULL, *persistent_id = "";
+ char *host = NULL, *persistent_id = NULL;
zend_long port = -1, retry_interval = 0;
size_t host_len, persistent_id_len;
double timeout = 0.0, read_timeout = 0.0;
@@ -919,13 +919,16 @@ redis_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
#endif
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(),
- "Os|ldsld", &object, redis_ce, &host,
+ "Os|lds!ld", &object, redis_ce, &host,
&host_len, &port, &timeout, &persistent_id,
&persistent_id_len, &retry_interval,
&read_timeout) == FAILURE)
{
return FAILURE;
- } else if (!persistent) {
+ }
+
+ /* Disregard persistent_id if we're not opening a persistent connection */
+ if (!persistent) {
persistent_id = NULL;
}