Skip to content

PHPRedis Cluster constants  #48361

Closed
Closed
@stemis

Description

@stemis

Laravel Version

10.16.1

PHP Version

8.1

Database Driver & Version

No response

Description

The PHPRedis library removed RedisCluster:: constants since 6.0.0. Released on pecl today 2023-09-11

However, these constants are still used:

$client->setOption(RedisCluster::OPT_PREFIX, $options['prefix']);

My build started failing today now that version 6.0.0 is on pecl, and I didn't lock down the pecl version.

I'm using cluster mode and have a prefix and the code is failing with:

Undefined constant RedisCluster::OPT_PREFIX
at vendor/laravel/framework/src/Illuminate/Redis/Connectors/PhpRedisConnector.php:191

The author of PHPREDIS recommends not using the constants of RedisCluster anymore but using the constants in Redis instead here: phpredis/phpredis#2262 (comment):

We updated how we create these class constants which is when I noticed I was duplicating all the constants for both classes. I think we want to only define them for Redis in the next version (which will be a major version bump)

I believe they are also backwards compatible as they were duplicated in Redis.php already.

Steps To Reproduce

  1. Use phpredis 6.0.0 (by default installed via PECL since today)
  2. Use cluster mode with a prefix

Workaround:

Instead of using pecl install redis, use pecl install redis-5.3.7

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions