Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e8f5b51

Browse files
yatsukhnenkomichael-grunder
authored andcommitted
Move options to the end list
1 parent 2bb6403 commit e8f5b51

9 files changed

Lines changed: 26 additions & 29 deletions

redis.stub.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ public function flushAll(?bool $sync = null): Redis|bool;
559559
*/
560560
public function flushDB(?bool $sync = null): Redis|bool;
561561

562-
public function geoadd(string $key, ?array $options = null, float $lng, float $lat, string $member, mixed ...$other_triples): Redis|int|false;
562+
public function geoadd(string $key, float $lng, float $lat, string $member, mixed ...$other_triples_and_options): Redis|int|false;
563563

564564
public function geodist(string $key, string $src, string $dst, ?string $unit = null): Redis|float|false;
565565

redis_arginfo.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 0ff87f3b3f10dacbef8455ba09b17fa4107c7999 */
2+
* Stub hash: dbcafdb797bd3a4a656d0e1708715bba10ed7f94 */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Redis___construct, 0, 0, 0)
55
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_ARRAY, 0, "null")
@@ -237,13 +237,12 @@ ZEND_END_ARG_INFO()
237237

238238
#define arginfo_class_Redis_flushDB arginfo_class_Redis_flushAll
239239

240-
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_class_Redis_geoadd, 0, 5, Redis, MAY_BE_LONG|MAY_BE_FALSE)
240+
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_class_Redis_geoadd, 0, 4, Redis, MAY_BE_LONG|MAY_BE_FALSE)
241241
ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
242-
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_ARRAY, 1, "null")
243242
ZEND_ARG_TYPE_INFO(0, lng, IS_DOUBLE, 0)
244243
ZEND_ARG_TYPE_INFO(0, lat, IS_DOUBLE, 0)
245244
ZEND_ARG_TYPE_INFO(0, member, IS_STRING, 0)
246-
ZEND_ARG_VARIADIC_TYPE_INFO(0, other_triples, IS_MIXED, 0)
245+
ZEND_ARG_VARIADIC_TYPE_INFO(0, other_triples_and_options, IS_MIXED, 0)
247246
ZEND_END_ARG_INFO()
248247

249248
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_class_Redis_geodist, 0, 3, Redis, MAY_BE_DOUBLE|MAY_BE_FALSE)

redis_cluster.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2759,7 +2759,7 @@ PHP_METHOD(RedisCluster, slowlog) {
27592759
}
27602760
/* }}} */
27612761

2762-
/* {{{ proto int RedisCluster::geoadd(string key, ?array options, float long float lat string mem, ...) */
2762+
/* {{{ proto int RedisCluster::geoadd(string key, float long float lat string mem, ...) */
27632763
PHP_METHOD(RedisCluster, geoadd) {
27642764
CLUSTER_PROCESS_CMD(geoadd, cluster_long_resp, 0);
27652765
}

redis_cluster.stub.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ public function flushall(string|array $key_or_address, bool $async = false): Red
165165

166166
public function flushdb(string|array $key_or_address, bool $async = false): RedisCluster|bool;
167167

168-
public function geoadd(string $key, ?array $options = null, float $lng, float $lat, string $member, mixed ...$other_triples): RedisCluster|int|false;
168+
public function geoadd(string $key, float $lng, float $lat, string $member, mixed ...$other_triples_and_options): RedisCluster|int|false;
169169

170170
public function geodist(string $key, string $src, string $dest, ?string $unit = null): RedisCluster|float|false;
171171

redis_cluster_arginfo.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: ae14a0f53c3ee46b132ef5db70e539c52a1388bd */
2+
* Stub hash: cb1fe939ac54b2c0e5de0c354fc4a6118336de61 */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RedisCluster___construct, 0, 0, 1)
55
ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 1)
@@ -232,13 +232,12 @@ ZEND_END_ARG_INFO()
232232

233233
#define arginfo_class_RedisCluster_flushdb arginfo_class_RedisCluster_flushall
234234

235-
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_class_RedisCluster_geoadd, 0, 5, RedisCluster, MAY_BE_LONG|MAY_BE_FALSE)
235+
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_class_RedisCluster_geoadd, 0, 4, RedisCluster, MAY_BE_LONG|MAY_BE_FALSE)
236236
ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
237-
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_ARRAY, 1, "null")
238237
ZEND_ARG_TYPE_INFO(0, lng, IS_DOUBLE, 0)
239238
ZEND_ARG_TYPE_INFO(0, lat, IS_DOUBLE, 0)
240239
ZEND_ARG_TYPE_INFO(0, member, IS_STRING, 0)
241-
ZEND_ARG_VARIADIC_TYPE_INFO(0, other_triples, IS_MIXED, 0)
240+
ZEND_ARG_VARIADIC_TYPE_INFO(0, other_triples_and_options, IS_MIXED, 0)
242241
ZEND_END_ARG_INFO()
243242

244243
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_class_RedisCluster_geodist, 0, 3, RedisCluster, MAY_BE_DOUBLE|MAY_BE_FALSE)

redis_cluster_legacy_arginfo.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: ae14a0f53c3ee46b132ef5db70e539c52a1388bd */
2+
* Stub hash: cb1fe939ac54b2c0e5de0c354fc4a6118336de61 */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RedisCluster___construct, 0, 0, 1)
55
ZEND_ARG_INFO(0, name)
@@ -204,13 +204,12 @@ ZEND_END_ARG_INFO()
204204

205205
#define arginfo_class_RedisCluster_flushdb arginfo_class_RedisCluster_flushall
206206

207-
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RedisCluster_geoadd, 0, 0, 5)
207+
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RedisCluster_geoadd, 0, 0, 4)
208208
ZEND_ARG_INFO(0, key)
209-
ZEND_ARG_INFO(0, options)
210209
ZEND_ARG_INFO(0, lng)
211210
ZEND_ARG_INFO(0, lat)
212211
ZEND_ARG_INFO(0, member)
213-
ZEND_ARG_VARIADIC_INFO(0, other_triples)
212+
ZEND_ARG_VARIADIC_INFO(0, other_triples_and_options)
214213
ZEND_END_ARG_INFO()
215214

216215
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RedisCluster_geodist, 0, 0, 3)

redis_commands.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3938,8 +3938,8 @@ redis_geoadd_cmd(INTERNAL_FUNCTION_PARAMETERS, RedisSock *redis_sock,
39383938
char *mode = NULL;
39393939
int argc, i;
39403940

3941-
// We at least need a key and one value
3942-
if ((argc = ZEND_NUM_ARGS()) < 5 || argc % 3 != 2) {
3941+
// We at least need a key and three values
3942+
if ((argc = ZEND_NUM_ARGS()) < 4 || (argc % 3 != 1 && argc % 3 != 2)) {
39433943
zend_wrong_param_count();
39443944
return FAILURE;
39453945
}
@@ -3951,13 +3951,14 @@ redis_geoadd_cmd(INTERNAL_FUNCTION_PARAMETERS, RedisSock *redis_sock,
39513951
return FAILURE;
39523952
}
39533953

3954-
if (Z_TYPE(z_args[1]) != IS_NULL) {
3955-
if (Z_TYPE(z_args[1]) != IS_ARRAY) {
3954+
if (argc % 3 == 2) {
3955+
argc--;
3956+
if (Z_TYPE(z_args[argc]) != IS_ARRAY) {
39563957
php_error_docref(NULL, E_WARNING, "Invalid options value");
39573958
efree(z_args);
39583959
return FAILURE;
39593960
}
3960-
ZEND_HASH_FOREACH_VAL(Z_ARRVAL(z_args[1]), z_ele) {
3961+
ZEND_HASH_FOREACH_VAL(Z_ARRVAL(z_args[argc]), z_ele) {
39613962
ZVAL_DEREF(z_ele);
39623963
if (Z_TYPE_P(z_ele) == IS_STRING) {
39633964
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,
39723973
}
39733974

39743975
/* Initialize our command */
3975-
REDIS_CMD_INIT_SSTR_STATIC(&cmdstr, argc - 1 + (mode != NULL) + ch, "GEOADD");
3976+
REDIS_CMD_INIT_SSTR_STATIC(&cmdstr, argc + (mode != NULL) + ch, "GEOADD");
39763977

39773978
/* Append key */
39783979
zstr = zval_get_string(&z_args[0]);
@@ -3986,7 +3987,7 @@ redis_geoadd_cmd(INTERNAL_FUNCTION_PARAMETERS, RedisSock *redis_sock,
39863987
REDIS_CMD_APPEND_SSTR_OPT_STATIC(&cmdstr, ch, "CH");
39873988

39883989
/* Append members */
3989-
for (i = 2; i < argc; ++i) {
3990+
for (i = 1; i < argc; ++i) {
39903991
redis_cmd_append_sstr_zval(&cmdstr, &z_args[i], redis_sock);
39913992
}
39923993

redis_legacy_arginfo.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 0ff87f3b3f10dacbef8455ba09b17fa4107c7999 */
2+
* Stub hash: dbcafdb797bd3a4a656d0e1708715bba10ed7f94 */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Redis___construct, 0, 0, 0)
55
ZEND_ARG_INFO(0, options)
@@ -219,13 +219,12 @@ ZEND_END_ARG_INFO()
219219

220220
#define arginfo_class_Redis_flushDB arginfo_class_Redis_flushAll
221221

222-
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Redis_geoadd, 0, 0, 5)
222+
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Redis_geoadd, 0, 0, 4)
223223
ZEND_ARG_INFO(0, key)
224-
ZEND_ARG_INFO(0, options)
225224
ZEND_ARG_INFO(0, lng)
226225
ZEND_ARG_INFO(0, lat)
227226
ZEND_ARG_INFO(0, member)
228-
ZEND_ARG_VARIADIC_INFO(0, other_triples)
227+
ZEND_ARG_VARIADIC_INFO(0, other_triples_and_options)
229228
ZEND_END_ARG_INFO()
230229

231230
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Redis_geodist, 0, 0, 3)

tests/RedisTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6230,7 +6230,7 @@ protected function rawCommandArray($key, $args) {
62306230
protected function addCities($key) {
62316231
$this->redis->del($key);
62326232
foreach ($this->cities as $city => $longlat) {
6233-
$this->redis->geoadd($key, null, $longlat[0], $longlat[1], $city);
6233+
$this->redis->geoadd($key, $longlat[0], $longlat[1], $city);
62346234
}
62356235
}
62366236

@@ -6244,11 +6244,11 @@ public function testGeoAdd() {
62446244

62456245
/* Add them one at a time */
62466246
foreach ($this->cities as $city => $longlat) {
6247-
$this->assertEquals($this->redis->geoadd('geokey', null, $longlat[0], $longlat[1], $city), 1);
6247+
$this->assertEquals($this->redis->geoadd('geokey', $longlat[0], $longlat[1], $city), 1);
62486248
}
62496249

62506250
/* Add them again, all at once */
6251-
$args = ['geokey', null];
6251+
$args = ['geokey'];
62526252
foreach ($this->cities as $city => $longlat) {
62536253
$args = array_merge($args, [$longlat[0], $longlat[1], $city]);
62546254
}

0 commit comments

Comments
 (0)