Commit Graph

3077 Commits

Author SHA1 Message Date
michael-grunder
828dc11c98 Clarify RedisCluster multi docs.
Fixes #2432
2024-03-28 13:34:39 -07:00
Bitactive
b698901818 Support for early_refresh in Redis sessions to match cluster behavior
Previously, the redis.session.early_refresh feature was implemented for
Redis Cluster, utilizing GETEX for the initial session read to minimize
the number of commands sent to the Redis server. However, this enhancement
was not applied to non-cluster sessions. This update addresses this
discrepancy, ensuring consistent behavior between Redis and Redis Cluster.
2024-03-28 13:19:47 -07:00
Jozsef Koszo
eb7f31e7af Fix random connection timeouts with Redis Cluster
When a node timeout occurs, then phpredis will try to connect to another
node, whose answer probably will be MOVED redirect. After this we need
more time to accomplish the redirection, otherwise we get "Timed out
attempting to find data in the correct node" error message.

Fixes #795 #888 #1142 #1385 #1633 #1707 #1811 #2407
2024-03-25 12:04:06 -07:00
Pavlo Yatsukhnenko
8323ddff80 Merge pull request #2471 from phpredis/dump-arginfo-zpp-mismatch
Fix Arginfo / zpp mismatch for DUMP command
2024-03-25 20:17:28 +02:00
Pavlo Yatsukhnenko
50e5405c03 Fix Arginfo / zpp mismatch for DUMP command 2024-03-25 19:28:29 +02:00
Tim Starling
37fa3592ce Mention KeyDB support in README.md
Mention support for KeyDB in README.md.

Remove credit for Owlient from the first paragraph. Owlient was acquired by Ubisoft in 2011, so presumably no longer benefit from such prominent credit.
2024-03-25 09:23:33 -07:00
michael-grunder
54d62c7240 Add KeyDB to CI
See: #2466
2024-03-22 19:08:45 -07:00
michael-grunder
d9c48b788d KeyDB: Get our tests passing against KeyDB.
This commit fixes our unit tests so they also pass against the KeyDB
server.  We didn't ned to change all that much.  Most of it was just
adding a version/keydb check.

The only change to PhpRedis itself was to relax the reply requirements
for XAUTOCLAIM.  Redis 7.0.0 added a third "these elements were recently
removed" reply which KeyDB does not have.

Fixes #2466
2024-03-22 07:47:43 -07:00
David Baker
c7a73abbd5 Remove mention of pickle 2024-03-21 20:05:02 -07:00
Pavlo Yatsukhnenko
f358687c72 Merge pull request #2467 from phpredis/multi-exec-segfault
Fix segfault and remove redundant macros
2024-03-21 17:59:07 +02:00
Pavlo Yatsukhnenko
a9e53fd16e Fix segfault and remove redundant macros
Replace `SOCKET_WRITE_COMMAND` with `redis_sock_write` because it can't be used
with pre-defined commands (it frees memory in case of failed writing operation).
After replacement `SOCKET_WRITE_COMMAND` becomes redundant so remove it.
2024-03-21 15:14:36 +02:00
Martin Vancl
8a39caebe8 add: session.save_path examples 2024-03-18 15:20:13 -07:00
michael-grunder
3dbc2bd814 Don't use deprecated string interpolation syntax. 2024-03-18 15:14:18 -07:00
michael-grunder
a51215ce2b Update random includes.
PHP 8.4 has some breaking changes with respect to where PHP's random methods and
helpers are.  This commit fixes those issues while staying backward compatible.

Fixes #2463
2024-03-18 15:14:07 -07:00
michael-grunder
2612d444e5 Update RedisCluster scan logic for large SCAN cursors.
We also need to update the `RedisCluster` logic to handle very large
curosr values, in addition to handling them for the `Redis` and
`RedisArray` classes.

See #2454, #2458
2024-03-18 11:54:02 -07:00
michael-grunder
e52f0afaed Update SCAN to handle very large cursor values.
Technically Redis may return any unsigned 64 bit integer as a scan
cursor.  This presents a problem for PHP in that PHP's integers are
signed.  Because of that if a scan cursor is > 2^63 it will overflow and
fail to work properly.

This commit updates our SCAN family of commands to deliver cursors in
their string form.

```php
public function scan(null|int|string $iterator, ...);
```

On initial entry into our SCAN family we convert either a NULL or empty
string cursor to zero, and send the initial scan command.

As Redis replies with cursors we either represent them as a long (if
they are <= ZEND_ULONG_MAX) and as a string if greater.  This should
mean the fix is minimally breaking as the following code will still
work:

```php
$it = NULL;
do {
    print_r($redis->scan($it));
} while ($it !== 0);
```

The `$it !== 0` still works because the zero cursor will be represented
as an integer.  Only absurdly large (> 2^63) values are represented as a
string.

Fixes #2454
2024-03-17 10:59:14 -07:00
michael-grunder
fa1a283ac9 Fix some typos 2024-03-13 13:46:58 -07:00
michael-grunder
4d233977a5 Update stubs 2024-03-13 13:07:26 -07:00
Michael Grunder
ece3f7bebc Fix config.m4 when using custom dep paths (#2453)
* We need both PHP_ADD_LIBRARY_WITH_PATH and PHP_ADD_INCLUDE

Fixes #2452

* Add an initial test block for ./configure correctness.
2024-03-04 21:03:01 -08:00
Benjamin Morel
77ab62bccb Tighter return types for Redis::(keys|hKeys|hVals|hGetAll)() 2024-02-21 13:17:23 -08:00
michael-grunder
732e466a6a Improve warning when we encounter an invalid EXPIRY in SET
We actually had two different bits of logic to handle EXPIRY values in
the `SET` command.  One for the legacy `SET` -> `SETEX` mapping and
another for the newer `SET foo bar EX <expiry>`.

Additionally the error message could be confusing.  Passing 3.1415 for
an `EX` expiry would fail as we didn't allow floats.

This commit consolidates expiry parsing to our existing helper function
as well as improves the `php_error_docref` warning in the event that the
user passes invalid data.  The warning will now tell the user the type
they tried to pass as an EXPIRY to make it easier to track down what's
going wrong.

Fixes #2448
2024-02-21 13:16:36 -08:00
Viktor Szépe
37c5f8d451 Fix typos 2024-02-21 13:16:12 -08:00
michael-grunder
9b90c03bd0 Update WAITAOF test to use different assertion + add debug info
* Add what value failed to pass our callback assertion so we can see
  what we actually got from the server.

* WAITAOF requires Redis >= 7.2.0 so don't run it if the server is older
  than that.
2024-02-20 12:00:54 -08:00
michael-grunder
ed7c9f6f63 Implement WAITAOF command. 2024-02-14 12:03:29 -08:00
SplotyCode
142c1f4a93 Fix retry_internal documentation 2024-02-13 14:07:34 -08:00
Takayasu Oyama
8f8ff72a79 Update zCount argument type in redis.stub.php (#2439)
* Update zCount argument type in redis.stub.php

zCount's min/max can also be an integer.

* fix arginfo
2024-01-24 12:46:50 -08:00
Pavlo Yatsukhnenko
5d293245cd Fix Redis::mget signature 2024-01-16 13:43:51 -08:00
michael-grunder
a4a283ab50 Change exec return method type hint 2024-01-16 13:43:16 -08:00
Alexandre Choura
14f93339c0 fix: RedisCluster::publish returns a cluster_long_resp 2024-01-16 12:58:17 -08:00
woodong
3fdd52b42d Fix the time unit of retry_interval 2024-01-16 11:23:00 -08:00
michael-grunder
6dc0a0be8d Fix segfault when passing just false to auth.
Fixes #2430
2024-01-09 12:55:06 -08:00
Pavlo Yatsukhnenko
f4ede5a637 Merge pull request #2429 from phpredis/session-tests
Set sessionSaveHandler
2023-12-20 08:36:42 +02:00
Pavlo Yatsukhnenko
9f8f80ca9d sessionSaveHandler 2023-12-19 20:01:47 +02:00
Pavlo Yatsukhnenko
77efcaa059 Merge pull request #2427 from RobiNN1/patch-1
Add PHP 8.3 to CI
2023-12-19 19:59:31 +02:00
Pavlo Yatsukhnenko
e051a5db3e PHP 8.3 is now released. 2023-12-19 15:59:31 +02:00
Róbert Kelčák
78d15140fa Add PHP 8.3 to CI
Also Windows setup-php-sdk action was moved to the official repo where is maintained again.
2023-12-02 12:36:44 +01:00
michael-grunder
ff305349db Update generated stubs
See #2398
2023-10-30 10:51:23 -07:00
Uładzimir Tsykun
df074dbe9e the VALUE argument type for hSetNx must be the same as for hSet 2023-10-30 10:51:23 -07:00
michael-grunder
12966a7413 Update generated stubs 2023-10-27 11:46:23 -07:00
Git'Fellow
9b5cad317b Fix anchor link 2023-10-25 08:23:36 -07:00
Pavlo Yatsukhnenko
a0c8fcc589 Back to dev 2023-10-22 21:12:44 +03:00
Pavlo Yatsukhnenko
efc9676035 Merge tag '6.0.2' into develop 2023-10-22 21:12:01 +03:00
Pavlo Yatsukhnenko
62cf943fec 6.0.2 6.0.2 2023-10-22 19:16:41 +03:00
Pavlo Yatsukhnenko
c9e92365e0 Update CHANGELOG.md 2023-10-22 19:08:58 +03:00
Pavlo Yatsukhnenko
abb3708c3d Fix deprecation error when passing null to match_type parameter 2023-10-22 19:03:39 +03:00
michael-grunder
3ec80ff09f Fix flaky test and OBJECT in a pipeline.
* We weren't properly passing `z_tab` through to the underlying OBJECT
  handler, which was causing PhpRedis to crash if you tried to execute
  the OBJECT command in a pipeline.

* Rework the `testTouch` unit test to try and avoid erroneous failures
  due to CI instance CPU scheduling.
2023-10-22 19:03:28 +03:00
michael-grunder
f404ecb833 Find our callback by pattern with PSUBSCRIBE
* Use the pattern Redis provides us not the channel, if this is
a wildcard based `PSUBSCRIBE` payload.

* Don't test whether our slots match in `SSUBSCRIBE` when not in cluster
  mode.

Fixes #2395
2023-10-22 19:03:04 +03:00
Pavlo Yatsukhnenko
7ed047870c Update CHANGELOG.md 2023-10-22 19:02:13 +03:00
Pavlo Yatsukhnenko
e7910dcc45 Merge pull request #2405 from phpredis/issue-2403
Fix deprecation error when passing null to match_type parameter
2023-10-14 00:27:40 +03:00
Pavlo Yatsukhnenko
b835aaa3f9 Fix deprecation error when passing null to match_type parameter 2023-10-13 17:50:37 +03:00