3419 Commits

Author SHA1 Message Date
michael-grunder d6437f5e95 Rework documentation for our local helper methods
Things like `_pack`, `_unpack`, `_serialize`, etc.
2025-11-07 10:43:05 -08:00
michael-grunder 107cc7aacb Make sure _digest throws an exception in PHP < 8.1 2025-11-06 11:00:16 -08:00
michael-grunder 00c62de277 Implement DELEX command 2025-11-06 09:48:09 -08:00
michael-grunder e2dd13ce7b Implement DIGEST and _digest helper (for php >= 8.1)
Redis implemented new CAS semantics which work both with values and the
XXH3 digest of those values.

This commit implements the Redis command itself and a helper which
computes the XXH3 digest locally. Note that we can only be sure to have
the `XXH3` hashing algorithm in PHP >= 8.1 so the `_digest` helper is
limited to PHP 8.1 or newer.
2025-11-06 09:48:09 -08:00
michael-grunder 025b0e9772 Prevent UB in session weighted selection
```c
int pos, i;
memcpy(&pos, key, sizeof(pos));
pos %= pool->totalWeight;
```

As unlikely as it is, this may cause UB if user's are generating their
own session IDs shorter than three bytes. This commit checks the session
id length and only copies in the bytes that we have.

Technically this could change behavior for session ID's of length 2 or
less, but this seems acceptable because currently such an ID would end
up selecing a server at random, depending on whatever bytes were past
the end of the `zend_string`.

In a future release we will fix this logic to use all of the entropy of
the session ID as well as ensure `pool->totalWeight` is > 0.
2025-11-05 13:49:20 -08:00
michael-grunder bf2047e067 Inform the user if we couldn't extract any session servers.
Add a specific warning when we can't parse any servers from
`php.session_save_path`.

PHP will then display the save path, but this will let users know there
was a problem parsing the path.

Fixes #1390

Signed-off-by: michael-grunder <michael.grunder@gmail.com>
2025-10-31 11:11:27 -07:00
michael-grunder 453c4788d6 Improve error message when picking session compression
The warning when a user picks an unsupported session compression
algorithm was pretty confusing.

The new message tells the user if the selection was invalid or only
invalid because the redis.so wasn't built with support.

Fixes #2570
2025-10-31 11:10:45 -07:00
michael-grunder 6e214c1698 Cloning our objects should not segfault
In a future release we can actually implement cloning logic along with
lazy reconnection but for now, just throw a fatal error.

Fixes #1760
2025-10-31 11:09:45 -07:00
michael-grunder 8894de5a0b Update stub hashes 2025-10-31 08:32:04 -07:00
Michael Telgmann b742bb8bdb fix: Change typehint to RedisArray 2025-10-31 07:54:44 -07:00
Michael Telgmann 9c9d0286f4 fix: Adjust PHPDoc comments to match parameter and return types 2025-10-31 07:54:44 -07:00
Michael Telgmann 8597d3d793 feat: Add method annotations for methods that are callable via magic __call method 2025-10-31 07:54:44 -07:00
Michael Telgmann 5afa8eb7e0 fix: Change nullable return types, so they can be better parsed 2025-10-31 07:54:44 -07:00
michael-grunder 4de4f727a4 WAIT and WAITAOF 2025-10-30 10:26:18 -07:00
michael-grunder 6b481b6f66 Document UNSUBSCRIBE and PUNSUBSCRIBE.
Fixes #1695
2025-10-30 09:29:02 -07:00
michael-grunder cd4cf653df Document WAIT and WAITAOF
Fixes #2541
2025-10-30 09:28:47 -07:00
michael-grunder c28430e5f6 Add specific TLS options documentation
Fixes #1999
2025-10-30 09:28:26 -07:00
Pavlo Yatsukhnenko 6c1fbf86ae Fix arginfo and stubs for RedisCluster 2025-10-30 09:24:20 -07:00
michael-grunder c8b79b1686 Add *.dep to .gitignore 2025-10-29 11:09:58 -07:00
michael-grunder c563c8cea3 Add missinig PECL/GitHub release urls 2025-10-19 14:47:02 -07:00
michael-grunder 4ff7d7e91e Merge release/6.3.0RC1 back into develop 2025-10-15 13:26:22 -07:00
michael-grunder ca25b6fd9f Prepare to tag 6.3.0RC1 6.3.0RC1 2025-10-14 16:06:23 -07:00
michael-grunder be4f14cccd Update CHANGELOG.md and package.xml 2025-10-09 18:37:40 -07:00
michael-grunder 675be9904d Update CHANGELOG.md 2025-10-09 12:11:20 -07:00
michael-grunder 0abe2c295e Fix HMGET where hash fields have an integer prefix
We were incorrectly ignoring errors when calling `is_numeric_string`,
meaning we would truncate hash fields that had integer prefixes.

```php
$redis->hmget('hash', ['123notaninteger']);
// Would actually execute:
// HMGET hash 123
```

Fixes #2731
2025-10-09 12:11:20 -07:00
michael-grunder 2f2d81149d Update CHANGELOG and package.xml 2025-10-06 16:24:55 -07:00
Pavlo Yatsukhnenko 7d3b2e4d6d Add hGetWithMeta method 2025-10-06 16:22:59 -07:00
michael-grunder 9dfc377902 Update CHANGELOG.md 2025-10-06 12:52:36 -07:00
michael-grunder 547475295a Introduce "must use attribute"
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.
2025-10-06 12:52:36 -07:00
Rasmus Lerdorf 5ebb853e1a Fix segfault during Redis Cluster failover
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>
2025-10-05 21:13:23 -07:00
Remi Collet f5db01b781 fix testXGrous expectation for change in redis 8.2.2 2025-10-03 06:03:36 -07:00
Remi Collet 4517d5f910 bump version 2025-10-03 06:03:36 -07:00
michael-grunder 6ca84b668c Update package.xml for the 6.3.0RC1 release. 2025-10-02 21:06:59 -07:00
michael-grunder f7e6981084 Normalize package.xml with an automatic formatter
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.
2025-10-02 21:06:59 -07:00
michael-grunder bddb0305f4 Minor changelog.md fix 2025-10-02 21:06:59 -07:00
michael-grunder 0fff135257 Add VRANGE commit to CHANGELOG.md 2025-10-02 21:06:59 -07:00
michael-grunder d01614b7a4 Add a release blurb. 2025-10-02 21:06:59 -07:00
michael-grunder 3822a11f45 Consolidate several similar commits + recategorize
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.
2025-10-02 21:06:59 -07:00
copilot-swe-agent[bot] 2e5e47da75 Add 6.3.0RC1 section to CHANGELOG.md
Co-authored-by: michael-grunder <468149+michael-grunder@users.noreply.github.com>
2025-10-02 21:06:59 -07:00
michael-grunder 6ce3bd533a Implement VRANGE command and add a test 2025-10-02 11:12:39 -07:00
Till Krüss 7a69d7301c Update sponsorship (#2719)
* 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.
2025-10-02 09:44:42 -07:00
Till Krüss 2066cfad26 document PECL configure options 2025-09-26 10:10:17 -07:00
Till Krüss 1d662f56aa Fix markdown headlines (#2718)
* fix markdown headlines
* fix headlines
* remove extra diviver
* remove nbsp
2025-09-25 13:16:50 -07:00
Till Krüss 0ac014764d Improve wording in README about project support 2025-09-23 16:56:48 -07:00
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