3294 Commits

Author SHA1 Message Date
Jakub Onderka
64da891e6f Do not allocate empty string or string with one character
From PHP 8, empty strings or string with one character don't need to be allocated. This change will reduce memory usage.
2024-11-26 10:39:23 -08:00
Jakub Onderka
99beb9221c Initialize arrays with known size
We know in advance the array size, so it makes sense to avoid reallocation when adding new elements. Also use immutable empty array in when we know in advance that redis will return zero elements.
2024-11-26 10:39:23 -08:00
Jakub Onderka
b665925eed Use smart str for constructing pipeline cmd 2024-11-25 09:41:27 -08:00
Pavlo Yatsukhnenko
6097e7ba50 Add PHP 8.4 to CI 2024-11-25 08:31:33 -08:00
michael-grunder
4cd3f59356 Implement KeyDB's EXPIREMEMBER[AT] commands 2024-11-15 08:59:10 -08:00
Jacob Brown
8144db3743 better documentation for the $tlsOptions parameter of RedisCluster 2024-11-04 17:29:03 -08:00
michael-grunder
0fe45d24d4 Fix XAUTOCLAIM argc when sending COUNT
Add 2 to argc not 1 + count when sending a specific COUNT.
2024-10-17 08:21:54 -07:00
michael-grunder
085d61ecfb Create a strncmp wrapper
On some glibc implementations strncmp is a macro. This commit simply creates a
`redis_strncmp` static inline wrapper function so we can `ZEND_STRL` instead of
manually counting the length or using `sizeof(s)-1` each time.

Fixes #2565
2024-10-15 10:40:15 -07:00
michael-grunder
eb66fc9e2f Pin ubuntu version for KeyDB 2024-10-15 10:40:15 -07:00
michael-grunder
985b0313fb KeyDB doesn't have a noble release yet. 2024-10-14 14:00:21 -07:00
Pavlo Yatsukhnenko
a53bf38b83 Merge pull request #2557 from cmb69/cmb/win-ci
Windows CI: update setup-php-sdk to v0.10 and enable caching
2024-10-08 12:57:37 +03:00
michael-grunder
5419cc9c60 Prepare for 6.1.0 GA 6.1.0 2024-10-04 11:28:33 -07:00
Remi Collet
52e69edefd improve package summary and description (#2558)
* improve package summary and description

* improve package summary and description
2024-10-03 11:06:56 -07:00
Christoph M. Becker
f89d4d8f6e Windows CI: update setup-php-sdk to v0.10 and enable caching 2024-09-30 15:39:25 +02:00
Remi Collet
5f241d8913 Merge pull request #2555 from phpredis/issue-redis62
fix 2 tests with redis 6.2
2024-09-24 16:15:31 +02:00
Remi Collet
cc1be32294 fix 2 tests with redis 6.2 2024-09-24 14:47:04 +02:00
Vincent Langlet
0bae4bb044 Fix urls 2024-09-23 15:58:45 -07:00
Michael Grunder
909c5cc13c Finalize 6.1.0RC2 changelog for completeness. (#2554)
* Finalize 6.1.0RC2 changelog for completeness.

* Fix CHANGELOG.md formatting + link to contributor users
6.1.0RC2
2024-09-23 13:56:48 -07:00
Remi Collet
bff3a22e9d fix implicit nullable (8.4) 2024-09-23 11:08:56 -07:00
Remi Collet
30c8f90cd9 bump version 2024-09-23 11:08:56 -07:00
michael-grunder
9bd2aaace4 Prepare for 6.1.0RC2 2024-09-23 11:08:56 -07:00
James Titcumb
b59e35a64f Added a composer.json to enable support for PIE 2024-09-20 09:03:11 -07:00
michael-grunder
a75a7e5a36 Fix SIGABRT in PHP 8.4
PHP switched from `ZEND_ASSUME` to `ZEND_ASSERT` when making sure
`Z_PTR_P(zv)` was nonnull in `zend_hash_str_update_ptr`.

This commit just switches to `zend_hash_str_add_empty_element` which
is semantically more correct anyway.

Fixes #2539
2024-09-19 22:41:28 -07:00
michael-grunder
9d38050093 Upload artifact v2 is deprecated 2024-09-19 14:51:09 -07:00
michael-grunder
40c897364f Remove erroneously duplicated changelog entries.
When constructing the 6.1.0RC1 CHANGELOG.md and package.xml a few
commits from older releases were accidentally included.

See #2474
2024-08-06 17:57:10 -07:00
Remi Collet
37cebdd70b cleanup code for unsupported versions 2024-08-05 08:58:58 -07:00
michael-grunder
8b51942357 Raise minimum supported PHP version to 7.4
See #2531
2024-08-05 01:08:51 -07:00
Remi Collet
e9474b80cb add missing SessionHelpers.php in pecl package 2024-08-05 00:30:28 -07:00
michael-grunder
ff3d5e3e06 Prepare to tag 6.1.0RC1 2024-08-04 13:56:47 -07:00
Viktor Djupsjöbacka
6ea5b3e08b Fix argument count issue in HSET with associative array, update method signature for HSET and add documentation 2024-07-17 12:47:49 -07:00
michael-grunder
6673b5b2be SRANDMEMBER can return any type because of serialization. 2024-07-13 23:12:25 -07:00
Michael Grunder
99f9fd8353 Fix HRANDFIELD command when WITHVALUES is used. (#2524)
Redis requires the user to send a count if `WITHVALUES` is specified,
otherwise it sees the `WITHVALUES` argument as the count and will error
out that it's not a number.

We can also return false if the key doesn't exist.
2024-07-13 22:42:25 -07:00
Michael Dwyer
eeb5109967 Update documentation (#2523)
* Remove/update mentions of removed methods

These methods were deprecated in a previous release

* Correct documentation for zInter/zinterstore

* Correct documentation for zUnion/zunionstore

* Add documentation for zDiff/zdiffstore

* Add documentation for zMscore
2024-07-11 21:49:29 -07:00
michael-grunder
50529f56e4 Context array should be nullable
Fixes #2521
2024-07-10 12:33:37 -07:00
michael-grunder
7de29d57d9 Fix a macOS (M1) compiler warning. 2024-07-08 20:50:06 -07:00
michael-grunder
981c69314d Add GETEX to README docs + minor change to command.
* Adds `GETEX` to the README.md documentation.
* Allow the user to send `PERSIST` either as an array key or just in the
  array, to conform with similar methods.
* Implement getEx for `RedisCluster`

Fixes #2512
2024-06-20 13:56:17 -07:00
Pavlo Yatsukhnenko
74f9e80516 Merge pull request #2513 from phpredis/script-command
Refactor redis_script_cmd
2024-06-20 21:45:17 +03:00
Pavlo Yatsukhnenko
7c551424b6 Refactor redis_script_cmd
- Update redis_script_cmd to use redis_build_script_cmd.
- Fix condition for parsing sync/async arguments of flush sub-command.
2024-06-20 21:05:20 +03:00
Michael Grunder
57304970cd PHP might throw a fatal error if we send no args to exists (#2510) 2024-06-18 16:05:21 -07:00
Michael Grunder
b1771defdc More unit test utility functions/usage. (#2509)
* More unit  test utility functions/usage.

* Add `assertKeyEquals` and `assertKeyEqualsWeak` as we test key values
  hundreds of places in `RedisTest.php`

* We are almost always using `$this->redis` when we want to run an
  assertion that needs access to the client, so make this argument
  optional and default to `$this->redis`.

* Update a few more assertions to use our new methods.

* Various minor fixes/tweaks.

* Update RedisTest.php

typo
2024-06-18 14:53:22 -07:00
michael-grunder
b808cc60ed Update tests so they can run in php-cgi.
This probably isn't a very common scenerio since we've never had someone
ask it in a decade, but it was very simple to get them working.

Primarily we just needed to test for `STDTOUT`/`STDERR` and use
`__DIR__` instead of `$_SERVER['PHP_SELF']`.

Fixes #2507
2024-06-17 11:46:44 -07:00
Michael Grunder
7050c98909 Play around with more ZEND_STRL usage (#2505)
* Play around with more ZEND_STRL usage

* strncasecmp is a macro on Windows
2024-06-15 14:48:30 -07:00
michael-grunder
d3b2d87b10 Don't use $k1 as a variable name.
There is a very strange edge case whn you try to run PHP under valgrind
and use certain specific strings like "$k1".

PHP interns these values in such a way that valgrind can't handle it and
hard aborts on sigsegv.  I don't know what the actual cause is but
simply renaming the variables is a workaround.
2024-06-01 17:35:58 -07:00
michael-grunder
f8c762e70b Use ZEND_STRL where appropriate.
Use the `ZEND_STRL` macro in several places rather than manually sending
a static string and its length as a constant.
2024-06-01 13:41:26 -07:00
michael-grunder
c139de3aba We don't need to use a ranom value for our ECHO liveness challenge.
A microsecond resolution timestamp combined with a monotonically
incremented counter should be sufficient.

This also fixes PHP 8.4 compilation as PHP 8.4 doesn't seem to have
`php_rand()`.
2024-06-01 13:41:26 -07:00
michael-grunder
dab6a62d34 Code formatting 2024-05-31 12:15:54 -07:00
michael-grunder
c6cd665bde Code formatting 2024-05-30 12:10:46 -07:00
michael-grunder
78b70ca8f4 More test refactoring.
* Switch remaining old-style PHP 5.4 `Array(...)` declarations to `[...]`
* Update variable names getting rid hungarian notation prefixes (e.g.
  `str_`, `i_`, etc).
* Allow cluster seeds to be passed on the command-line instead of soley
  relying on either a node environment variable or our
  tests/nodes/nodemap file.  This should make it easier to run ad-hoc
  cluster tests by specifying just a single seed.
* Add some diagnostics for when we can't find a suitable cluster to run
  our tests against indicating exactly where we looked for the env var
  and node file.
* Refactor RedisArray tests to use our newer TestSuite assertions.
* Allow `RedisArray` ports to be specified on the command-line as well.
* Various formatting fixes.
* More robust KeyDB detection.
2024-05-29 23:02:29 -07:00
michael-grunder
0d89e92889 Spelling fixes 2024-05-28 21:05:08 -07:00
michael-grunder
e18f6c6d9e Minor refactor 2024-05-28 20:32:50 -07:00