forked from phpredis/phpredis
-
Notifications
You must be signed in to change notification settings - Fork 0
[pull] develop from phpredis:develop #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
pull
wants to merge
158
commits into
wudi:develop
Choose a base branch
from
phpredis:develop
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* Update zCount argument type in redis.stub.php zCount's min/max can also be an integer. * fix arginfo
* 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.
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
* We need both PHP_ADD_LIBRARY_WITH_PATH and PHP_ADD_INCLUDE Fixes #2452 * Add an initial test block for ./configure correctness.
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
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
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.
Fix segfault and remove redundant macros
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
See: #2466
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.
Fix Arginfo / zpp mismatch for DUMP command
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
Adds an option that instructs PhpRedis to not serialize or compress numeric values. Specifically where `Z_TYPE_P(z) == IS_LONG` or `Z_TYPE_P(z) == IS_DOUBLE`. This flag lets the user enable serialization and/or compression while still using the various increment/decrement command (`INCR`, `INCRBY`, `DECR`, `DECRBY`, `INCRBYFLOAT`, `HINCRBY`, and `HINCRBYFLOAT`). Because PhpRedis can't be certain that this option was enabled when writing keys, there is a small runtime cost on the read-side that tests whether or not the value its reading is a pure integer or floating point value. See #23
* We want to run the logic if either a serializer OR a compression option is set. * IEE754 doubles can theoretically have a huge number of characters.
Add `getWithMeta` method
For an error reply we're starting at `buf + 1` so we want `len - 1`. As a sanity check we now return early if `len < 1`. Also, make certain that len > 2 for our special detection of `*-1` since we're doing `memcmp(buf + 1, "-1", 2);`
Redis and Valkey doesn't consider command as invalid if order of arguments is changed but other servers like DragonflyDB does. In this commit `SET` command is fixed to more strictly follow the specs. Also fixed usage of `zend_tmp_string` for `ifeq` argument.
Right now we can't implement `HELLO` command to switch protocol because we don't support new reply types that come with RESP3. But we can use `HELLO` reply to expose some server information.
This lets a subclass override it
* cleanup session temp file * Fix Deprecated: Automatic conversion of false to array
* New option 'database' for Redis class constructor Selecting database is very common action after connecting to Redis. This simplifies lazy connecting to Redis, when requested database will be selected after first command. * More specific exception message when invalid auth or database number is provided Before it was just 'Redis server went away' * Rename reselect_db method to redis_select_db and slightly optimise it
This method always unpack given string to zval, so it is not necessary to check output value
Deduplicate code that is used in many methods. Also optimise adding new element to array in pipeline mode and returning zval in atomic mode
`Redis::hGetAll()` returns an array indexed by `string`s and/or `int`s depending on the values in the hash set. The function in the PHP stub was annotated as though the array were keyed only by strings, which is tighter than reality.
DragonflyDB will report to be Redis but also include `dragonfly_version` in the hello response, which we can use to identify the fork. Also fix parsing of the `HELLO` response for `serverName()` and `serverVersion()`. Starting in Redis 8.0 there seem to always be modules running, which the previous function was not expecting or parsing.
Commands implemented: `H[P]EXPIRE` `H[P]TTL` `H[P]EXPIREAT` `H[P]EXPIRETIME` `HPERSIST`
We often have to rerun the test suite on GitHub actions because of a hard to reproduce "Read error on connection" exception when getting a new `RedisCluster` instance. No one has ever reported this failure outside of GitHub CI and it's not clear exactly what might be going on. This commit does two main things: 1. Allows for one failure to construct a new `RedisCluster` instance but only if we detect we're running in GitHub CI. 2. Adds much more diagnostic information if we still have a fatal error (e.g. we can't connect in two tries, or some other fatal error happens). The new info includes the whole callstack before aborting as well as an attempt to manually ping the seeds with `redis-cli`.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot]
Can you help keep this open source service alive? 💖 Please sponsor : )