Commit Graph

3275 Commits

Author SHA1 Message Date
Remi Collet c0076036d9 Improve install instructions
- using pie
- Fedora and EL have v6
2025-09-18 08:29:19 -07:00
Copilot 09cd4c54b9 Clean up README.md: fix typos, spelling, and grammar errors (#2713)
* Fix typos and basic grammar errors in README.md

Co-authored-by: michael-grunder <468149+michael-grunder@users.noreply.github.com>

* Improve grammar, clarity, and consistency in README.md

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Michael Grunder <michael.grunder@gmail.com>
2025-09-13 10:59:30 -07:00
michael-grunder e9e9e49509 Add maxRetries to redis_sock_configure.
This lets users configure `maxRetries` with `RedisSentinel`

Fixes #2700
2025-09-12 09:32:02 -07:00
Josh f9f609e1eb Refine parameter descriptions and examples in README 2025-09-12 09:31:37 -07:00
michael-grunder 1d07c3a07e Add a .github/copilot-instructions.md file
Additionally remove `.github` from our root-level `.gitignore` file. I
assume it was erroneously added some time ago since we have files in
this repo.

Fixes #2705
2025-09-10 16:54:46 -07:00
michael-grunder f24814a423 Fix geosearchstore bypolygon test
In cluster mode the destination and source keys must hash to the same
slot.
2025-09-10 11:56:49 -07:00
michael-grunder b3da0f3bcf Remove a "bad argument" assertion for testWait
It seems like Redis changed what it will do when you send a negative
number of events. Previously this would just return an error but it
seems to return `1` now.

For this reason just remove that assertion so we don't have to use
different logic depending on the version of the server.
2025-09-10 11:33:35 -07:00
michael-grunder 22a2914b09 Add a regression test 2025-09-09 16:30:43 -07:00
michael-grunder 35df8ad7c2 Attempt to fix an overflow bug in ZADD on Windows
Theory: In 64 bit windows `long` is 32 bits wide meaning that using a
long to append `ZADD` scores can truncate.

Possible fix for #2697
2025-09-09 16:30:43 -07:00
Christian Flothmann 25e6d5fcc2 fix typo (s/sees/seeds/) 2025-09-07 14:34:05 -07:00
Michael Grunder d0b0c5cfdd Fix typo
Co-authored-by: Pavlo Yatsukhnenko <yatsukhnenko@users.noreply.github.com>
2025-09-01 09:41:12 -07:00
michael-grunder 92137ffd3f We actually do return bool in sismember so do the same here 2025-09-01 09:41:12 -07:00
michael-grunder 38115decb9 Fix VISMEMBER unit test 2025-09-01 09:41:12 -07:00
michael-grunder b8de91c9e0 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
2025-09-01 09:41:12 -07:00
michael-grunder 92dd256f98 Implement VISMEMBER command. 2025-09-01 09:41:12 -07:00
michael-grunder c4b2ea6ca5 Fix VEMB reply handling in RedisCluster 2025-09-01 09:41:12 -07:00
michael-grunder 0b4b4ed2c3 Add a test for VGETATTR 2025-09-01 09:41:12 -07:00
michael-grunder d80b725824 Implement VGETATTR command 2025-09-01 09:41:12 -07:00
michael-grunder 7f9b1f416e Implement VLINKS command 2025-09-01 09:41:12 -07:00
michael-grunder ea11d62aec Test for VSETATTR 2025-09-01 09:41:12 -07:00
michael-grunder 92716ed0c5 Implement VSETATTR command 2025-09-01 09:41:12 -07:00
michael-grunder 65927b53b1 We can use redis_kv_cmd instead of a specific vrem command. 2025-09-01 09:41:12 -07:00
michael-grunder 5fe188416d Add a test for VRANDMEMBER 2025-09-01 09:41:12 -07:00
michael-grunder bbae745a93 Add a test for VREM
See #2543
2025-09-01 09:41:12 -07:00
michael-grunder dc91631b3f Implement VREM command
See #2543
2025-09-01 09:41:12 -07:00
michael-grunder 1deca62841 Implement VRANDMEMBER
`VRANDMEMBER` has the exact same semantics of `SRANDMEMBER` so make
`SRANDMEMBER` a keyword based command and use it for `VRANDMEMBER`.

See #2543
2025-09-01 09:41:12 -07:00
michael-grunder 96378b70fd Implement VEMB and slightly rework VINFO
Unfortunately `VEMB` has a unique `RESP2` reply as far as I can tell,
where it sends the embedding mode (int8, bin, fp32) as a simple string.

This would cause any of PhpRedis' generic reply handlers to turn that
into `true` which isn't useful. For that reason we need a custom reply
handler.

Additionally slightly rework `VINFO` to short circuit and return failure
if we read anything other than a bulk string or an integer reply type.
Otherwise we may get out of sync on the socket.

See #2543
2025-09-01 09:41:12 -07:00
michael-grunder 8f8a49bec2 Tests for VCARD, VDIM, and VINFO. 2025-09-01 09:41:12 -07:00
michael-grunder 0fda9f293b Implement VCARD, VDIM, and VINFO
All of these commands have the same form `<cmd> key`. `VINFO` is a bit
of an outlier however that uses simple strings as opposed to bulk
strings for the key names, meaning we had to create a custom handler.

See #2543
2025-09-01 09:41:12 -07:00
michael-grunder 0ed0fc0562 Add Redis::REDIS_VECTORSET type.
Redis >= 8.0 has a new type `vectorset` that we should support like all
the other types.
2025-08-28 09:34:07 -07:00
michael-grunder 659dc763e0 Refactor redis_replicaof_cmd
It was the last place we were using `REDIS_SPPRINTF` in
`redis_commands.c`.
2025-08-27 16:37:08 -07:00
michael-grunder 8d369f4d62 Implement GEOSEARCH[STORE] BYPOLYGON.
Valkey 9.0.0 implemented a new variant of `GEOSEARCH` where you supply
the verticies to an arbitrary polygon.

Since we can't modify the `geosearch` prototype using it is a little
wonky (you need to just pass empty strings for position and unit).

```php
$redis->geosearch('ca:cities', '', [
    -121.90, 39.65, -121.77, 39.65, -121.77, 39.80, -121.90, 39.80
], '');
$redis->geosearchstore('ca:cities', 'dst', '', [
    -121.90, 39.65, -121.77, 39.65, -121.77, 39.80, -121.90, 39.80
], '');
```
2025-08-24 06:37:51 -07:00
michael-grunder b1b0c19142 Implement DELIFEQ command
Implement the command and add a test.
2025-08-24 06:37:28 -07:00
Jacob Brown b0ba827be2 Fixing segfault in cluster_update_slot
When the slot's->slaves was null, it was dereferencing null, causing
segfault.
This happens in weird scenario when some of the nodes in cluster are
down or having changed IP addresses without knowing about it.
2025-08-22 11:59:38 -07:00
Michael Grunder 8685c49c70 Use continue not break if we get a NULL node
This is likely to never happen but just skipping NULL nodes is better than aborting the reset.

Co-authored-by: Pavlo Yatsukhnenko <yatsukhnenko@users.noreply.github.com>
2025-08-21 08:53:51 -07:00
michael-grunder f4ec5e2bb0 Use ZEND_STRL instead of literal, len 2025-08-21 08:53:51 -07:00
michael-grunder a0621555b5 Reduce to < 80 chars 2025-08-21 08:53:51 -07:00
michael-grunder 03837f0230 Remove pointless casts
You never have to explicitly cast between `void*` and any other pointer
type.
2025-08-21 08:53:51 -07:00
michael-grunder 7769194757 Change int flags to zend_bool since we only use them as booleans 2025-08-21 08:53:51 -07:00
michael-grunder 9802fc0e46 Rework REDIS_SAVE_CALLBACK to be a function. 2025-08-21 08:53:51 -07:00
michael-grunder 58e1a04f76 Remove wrapper macro which hides branching logic
This wrapper macro implicitly defines an `} else {` block but this is
not clear at the callsite which obsures what is actually going on.

There's no real advantage to the wrapping macro. Instead just call the
underlying macro in an explicit else branch.
2025-08-21 08:53:51 -07:00
michael-grunder 8f0931bbed Rework REDIS_PROCESS_REQUEST to be a function. 2025-08-21 08:53:51 -07:00
michael-grunder 7c953d458b Remove dead legacy code. 2025-08-21 08:53:51 -07:00
michael-grunder 950d2bc79d Rework REDIS_PROCESS_KW_CMD as a function 2025-08-21 08:53:51 -07:00
michael-grunder 601ebbff2b Rework REDIS_PROCESS_CMD into a static function 2025-08-21 08:53:51 -07:00
michael-grunder c3a7163108 Rework CLUSTER_RESET_MULTI to be a static function 2025-08-21 08:53:51 -07:00
michael-grunder b004051499 Rewowrk CLUSTER_FREE_QUEUE as a static function 2025-08-21 08:53:51 -07:00
michael-grunder fae89fa992 Remove dead macro CLUSTER_BUILD_CMD 2025-08-21 08:53:51 -07:00
michael-grunder f880e1f727 Make CLUSTER_ENQUEUE_RESPONSE a static function 2025-08-21 08:53:51 -07:00
michael-grunder b90e27f285 Rework CLUSTER_PROCESS_KW_CMD to be a small wrapper macro + function
This commit is similar to the last one reworking processing keyword
commands to work to use a function instead of a big multiline macro.
2025-08-21 08:53:51 -07:00