diff options
author | michael-grunder <michael.grunder@gmail.com> | 2019-05-15 22:38:11 +0300 |
---|---|---|
committer | Michael Grunder <michael.grunder@gmail.com> | 2019-05-16 19:19:37 +0300 |
commit | 60223762ada628c26cb82386bed281e4ec097f4f (patch) | |
tree | a79aff3ec5387a38a9d0c51ebd1a3646b14c85d0 /redis.c | |
parent | 4f352059433215072e856b004e1edd69920381d6 (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.c | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -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; } |