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:
authorPavlo Yatsukhnenko <yatsukhnenko@gmail.com>2022-10-30 20:49:05 +0300
committerMichael Grunder <michael.grunder@gmail.com>2022-10-30 22:00:12 +0300
commite8f5b517484a16756dcfc83168c65fc0604c4ab0 (patch)
tree7ddea6991bd7818b425a12b61547ff0622453984
parent2bb64038837419a2d661376a56e5f40c51144522 (diff)
Move `options` to the end list
-rw-r--r--redis.stub.php2
-rw-r--r--redis_arginfo.h7
-rw-r--r--redis_cluster.c2
-rw-r--r--redis_cluster.stub.php2
-rw-r--r--redis_cluster_arginfo.h7
-rw-r--r--redis_cluster_legacy_arginfo.h7
-rw-r--r--redis_commands.c15
-rw-r--r--redis_legacy_arginfo.h7
-rw-r--r--tests/RedisTest.php6
9 files changed, 26 insertions, 29 deletions
diff --git a/redis.stub.php b/redis.stub.php
index fddcec9b..c0ff8e26 100644
--- a/redis.stub.php
+++ b/redis.stub.php
@@ -559,7 +559,7 @@ class Redis {
*/
public function flushDB(?bool $sync = null): Redis|bool;
- public function geoadd(string $key, ?array $options = null, float $lng, float $lat, string $member, mixed ...$other_triples): Redis|int|false;
+ public function geoadd(string $key, float $lng, float $lat, string $member, mixed ...$other_triples_and_options): Redis|int|false;
public function geodist(string $key, string $src, string $dst, ?string $unit = null): Redis|float|false;
diff --git a/redis_arginfo.h b/redis_arginfo.h
index e685218d..4e6e20b9 100644
--- a/redis_arginfo.h
+++ b/redis_arginfo.h
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
- * Stub hash: 0ff87f3b3f10dacbef8455ba09b17fa4107c7999 */
+ * Stub hash: dbcafdb797bd3a4a656d0e1708715bba10ed7f94 */
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Redis___construct, 0, 0, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_ARRAY, 0, "null")
@@ -237,13 +237,12 @@ ZEND_END_ARG_INFO()
#define arginfo_class_Redis_flushDB arginfo_class_Redis_flushAll
-ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_class_Redis_geoadd, 0, 5, Redis, MAY_BE_LONG|MAY_BE_FALSE)
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_class_Redis_geoadd, 0, 4, Redis, MAY_BE_LONG|MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
- ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_ARRAY, 1, "null")
ZEND_ARG_TYPE_INFO(0, lng, IS_DOUBLE, 0)
ZEND_ARG_TYPE_INFO(0, lat, IS_DOUBLE, 0)
ZEND_ARG_TYPE_INFO(0, member, IS_STRING, 0)
- ZEND_ARG_VARIADIC_TYPE_INFO(0, other_triples, IS_MIXED, 0)
+ ZEND_ARG_VARIADIC_TYPE_INFO(0, other_triples_and_options, IS_MIXED, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_class_Redis_geodist, 0, 3, Redis, MAY_BE_DOUBLE|MAY_BE_FALSE)
diff --git a/redis_cluster.c b/redis_cluster.c
index c3fdef3c..e611315d 100644
--- a/redis_cluster.c
+++ b/redis_cluster.c
@@ -2759,7 +2759,7 @@ PHP_METHOD(RedisCluster, slowlog) {
}
/* }}} */
-/* {{{ proto int RedisCluster::geoadd(string key, ?array options, float long float lat string mem, ...) */
+/* {{{ proto int RedisCluster::geoadd(string key, float long float lat string mem, ...) */
PHP_METHOD(RedisCluster, geoadd) {
CLUSTER_PROCESS_CMD(geoadd, cluster_long_resp, 0);
}
diff --git a/redis_cluster.stub.php b/redis_cluster.stub.php
index f6ab90e8..e968185d 100644
--- a/redis_cluster.stub.php
+++ b/redis_cluster.stub.php
@@ -165,7 +165,7 @@ class RedisCluster {
public function flushdb(string|array $key_or_address, bool $async = false): RedisCluster|bool;
- public function geoadd(string $key, ?array $options = null, float $lng, float $lat, string $member, mixed ...$other_triples): RedisCluster|int|false;
+ public function geoadd(string $key, float $lng, float $lat, string $member, mixed ...$other_triples_and_options): RedisCluster|int|false;
public function geodist(string $key, string $src, string $dest, ?string $unit = null): RedisCluster|float|false;
diff --git a/redis_cluster_arginfo.h b/redis_cluster_arginfo.h
index 15492cb2..7fea6bb5 100644
--- a/redis_cluster_arginfo.h
+++ b/redis_cluster_arginfo.h
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
- * Stub hash: ae14a0f53c3ee46b132ef5db70e539c52a1388bd */
+ * Stub hash: cb1fe939ac54b2c0e5de0c354fc4a6118336de61 */
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RedisCluster___construct, 0, 0, 1)
ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 1)
@@ -232,13 +232,12 @@ ZEND_END_ARG_INFO()
#define arginfo_class_RedisCluster_flushdb arginfo_class_RedisCluster_flushall
-ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_class_RedisCluster_geoadd, 0, 5, RedisCluster, MAY_BE_LONG|MAY_BE_FALSE)
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_class_RedisCluster_geoadd, 0, 4, RedisCluster, MAY_BE_LONG|MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
- ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_ARRAY, 1, "null")
ZEND_ARG_TYPE_INFO(0, lng, IS_DOUBLE, 0)
ZEND_ARG_TYPE_INFO(0, lat, IS_DOUBLE, 0)
ZEND_ARG_TYPE_INFO(0, member, IS_STRING, 0)
- ZEND_ARG_VARIADIC_TYPE_INFO(0, other_triples, IS_MIXED, 0)
+ ZEND_ARG_VARIADIC_TYPE_INFO(0, other_triples_and_options, IS_MIXED, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_class_RedisCluster_geodist, 0, 3, RedisCluster, MAY_BE_DOUBLE|MAY_BE_FALSE)
diff --git a/redis_cluster_legacy_arginfo.h b/redis_cluster_legacy_arginfo.h
index d1630ef0..5ee913e8 100644
--- a/redis_cluster_legacy_arginfo.h
+++ b/redis_cluster_legacy_arginfo.h
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
- * Stub hash: ae14a0f53c3ee46b132ef5db70e539c52a1388bd */
+ * Stub hash: cb1fe939ac54b2c0e5de0c354fc4a6118336de61 */
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RedisCluster___construct, 0, 0, 1)
ZEND_ARG_INFO(0, name)
@@ -204,13 +204,12 @@ ZEND_END_ARG_INFO()
#define arginfo_class_RedisCluster_flushdb arginfo_class_RedisCluster_flushall
-ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RedisCluster_geoadd, 0, 0, 5)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RedisCluster_geoadd, 0, 0, 4)
ZEND_ARG_INFO(0, key)
- ZEND_ARG_INFO(0, options)
ZEND_ARG_INFO(0, lng)
ZEND_ARG_INFO(0, lat)
ZEND_ARG_INFO(0, member)
- ZEND_ARG_VARIADIC_INFO(0, other_triples)
+ ZEND_ARG_VARIADIC_INFO(0, other_triples_and_options)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RedisCluster_geodist, 0, 0, 3)
diff --git a/redis_commands.c b/redis_commands.c
index e17fce1f..7a9812fc 100644
--- a/redis_commands.c
+++ b/redis_commands.c
@@ -3938,8 +3938,8 @@ redis_geoadd_cmd(INTERNAL_FUNCTION_PARAMETERS, RedisSock *redis_sock,
char *mode = NULL;
int argc, i;
- // We at least need a key and one value
- if ((argc = ZEND_NUM_ARGS()) < 5 || argc % 3 != 2) {
+ // We at least need a key and three values
+ if ((argc = ZEND_NUM_ARGS()) < 4 || (argc % 3 != 1 && argc % 3 != 2)) {
zend_wrong_param_count();
return FAILURE;
}
@@ -3951,13 +3951,14 @@ redis_geoadd_cmd(INTERNAL_FUNCTION_PARAMETERS, RedisSock *redis_sock,
return FAILURE;
}
- if (Z_TYPE(z_args[1]) != IS_NULL) {
- if (Z_TYPE(z_args[1]) != IS_ARRAY) {
+ if (argc % 3 == 2) {
+ argc--;
+ if (Z_TYPE(z_args[argc]) != IS_ARRAY) {
php_error_docref(NULL, E_WARNING, "Invalid options value");
efree(z_args);
return FAILURE;
}
- ZEND_HASH_FOREACH_VAL(Z_ARRVAL(z_args[1]), z_ele) {
+ ZEND_HASH_FOREACH_VAL(Z_ARRVAL(z_args[argc]), z_ele) {
ZVAL_DEREF(z_ele);
if (Z_TYPE_P(z_ele) == IS_STRING) {
if (zend_string_equals_literal_ci(Z_STR_P(z_ele), "NX") ||
@@ -3972,7 +3973,7 @@ redis_geoadd_cmd(INTERNAL_FUNCTION_PARAMETERS, RedisSock *redis_sock,
}
/* Initialize our command */
- REDIS_CMD_INIT_SSTR_STATIC(&cmdstr, argc - 1 + (mode != NULL) + ch, "GEOADD");
+ REDIS_CMD_INIT_SSTR_STATIC(&cmdstr, argc + (mode != NULL) + ch, "GEOADD");
/* Append key */
zstr = zval_get_string(&z_args[0]);
@@ -3986,7 +3987,7 @@ redis_geoadd_cmd(INTERNAL_FUNCTION_PARAMETERS, RedisSock *redis_sock,
REDIS_CMD_APPEND_SSTR_OPT_STATIC(&cmdstr, ch, "CH");
/* Append members */
- for (i = 2; i < argc; ++i) {
+ for (i = 1; i < argc; ++i) {
redis_cmd_append_sstr_zval(&cmdstr, &z_args[i], redis_sock);
}
diff --git a/redis_legacy_arginfo.h b/redis_legacy_arginfo.h
index ef1aeb0e..84388245 100644
--- a/redis_legacy_arginfo.h
+++ b/redis_legacy_arginfo.h
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
- * Stub hash: 0ff87f3b3f10dacbef8455ba09b17fa4107c7999 */
+ * Stub hash: dbcafdb797bd3a4a656d0e1708715bba10ed7f94 */
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Redis___construct, 0, 0, 0)
ZEND_ARG_INFO(0, options)
@@ -219,13 +219,12 @@ ZEND_END_ARG_INFO()
#define arginfo_class_Redis_flushDB arginfo_class_Redis_flushAll
-ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Redis_geoadd, 0, 0, 5)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Redis_geoadd, 0, 0, 4)
ZEND_ARG_INFO(0, key)
- ZEND_ARG_INFO(0, options)
ZEND_ARG_INFO(0, lng)
ZEND_ARG_INFO(0, lat)
ZEND_ARG_INFO(0, member)
- ZEND_ARG_VARIADIC_INFO(0, other_triples)
+ ZEND_ARG_VARIADIC_INFO(0, other_triples_and_options)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Redis_geodist, 0, 0, 3)
diff --git a/tests/RedisTest.php b/tests/RedisTest.php
index c0ab9c08..336cf23e 100644
--- a/tests/RedisTest.php
+++ b/tests/RedisTest.php
@@ -6230,7 +6230,7 @@ class Redis_Test extends TestSuite
protected function addCities($key) {
$this->redis->del($key);
foreach ($this->cities as $city => $longlat) {
- $this->redis->geoadd($key, null, $longlat[0], $longlat[1], $city);
+ $this->redis->geoadd($key, $longlat[0], $longlat[1], $city);
}
}
@@ -6244,11 +6244,11 @@ class Redis_Test extends TestSuite
/* Add them one at a time */
foreach ($this->cities as $city => $longlat) {
- $this->assertEquals($this->redis->geoadd('geokey', null, $longlat[0], $longlat[1], $city), 1);
+ $this->assertEquals($this->redis->geoadd('geokey', $longlat[0], $longlat[1], $city), 1);
}
/* Add them again, all at once */
- $args = ['geokey', null];
+ $args = ['geokey'];
foreach ($this->cities as $city => $longlat) {
$args = array_merge($args, [$longlat[0], $longlat[1], $city]);
}