Conditionally add `[[nodiscard]]` (c23) or
`__attribute__((warn_unused_result))` when the compiler supports it.
This commit initially just adds iit to `cluster_map_keyspace` but we can
go throughour API adding it where appropriate.
When a Redis Cluster failover occurs, the client detects that the
redirected node was a replica of the old master and calls
cluster_map_keyspace() to remap the cluster topology.
If cluster_map_keyspace() fails (e.g., due to network issues during
the remap), it frees all node objects via zend_hash_clean(c->nodes)
and zeros the master array via memset(c->master, 0, ...).
The bug was that the return value of cluster_map_keyspace() was being
ignored in the failover detection path. This caused the code to
continue with NULL socket pointers, leading to segfaults when
dereferencing c->cmd_sock later.
This fix:
1. Checks the return value of cluster_map_keyspace() in failover
detection and returns FAILURE if it fails
2. Adds defense-in-depth NULL checks after MOVED and ASK redirections
to prevent segfaults if slots become NULL for any reason
Fixes production crashes observed during Redis Cluster failovers.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
We've basically maintained `package.xml` by hand all these years which
makes it a pretty big pain to do a new release. This commit uses a small
utility program to normalize the spacing with PHP's simplexml extension.
We can consoildate a bunch of commits into one changelong line item
(e.g. all the vectorset commits).
Additionally recategorize several other line items to best fit our
categories.
* Update contact information in README.md
* align sponsorship logos
Added PayPal as an additional support option for the project.
* add spacing
Added line breaks for improved formatting.
* fix list indentation
* mention relay
Added a new section on sponsorship and support for the project.
* Update Relay support description in README
Clarified the description of Relay's support for PhpRedis.
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
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.
* 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
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
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