8 Commits

Author SHA1 Message Date
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
a4a283ab50 Change exec return method type hint 2024-01-16 13:43:16 -08:00
Nicolas Grekas
5e4bdf97c8 Fix arginfo for arguments that default to null 2023-07-27 17:57:44 +02:00
Remi Collet
3675f442e4 mark auth param as sensitive for PHP 8.2
refactor MINIT (split in each class sources file)
use @generate-class-entries in stub files
add RedisException and RedisClusterException in stub files
2022-07-18 13:45:45 +02:00
Pavlo Yatsukhnenko
14d121bb69 Allow to pass null as iterator 2022-02-01 21:02:59 +02:00
Pavlo Yatsukhnenko
8689ab1c17 Issue #1393 2022-01-30 10:16:46 -08:00
Pavlo Yatsukhnenko
08a9d5db91 Issue #2055 2022-01-20 11:43:10 -08:00
Pavlo Yatsukhnenko
c8ae539523 Use stub/arginfo for RedisArray 2021-08-26 09:53:51 +03:00