Skip to content

Fix PHP 8.1 deprecated warning for Redis::connect() call #20234

@heurteph-ei

Description

@heurteph-ei

From forum: https://forum.matomo.org/t/redis-cache-with-unix-socket-and-php-8-1/46757

whocarez
With Matomo 4.10.1 [then 4.13.0 and 4.13.1] and activated RedisCache on an unix socket I got an error like this
PHP Deprecated: Redis::connect(): Passing null to parameter #2 ($port) of type int is deprecated in /var/www/matomo/vendor/matomo/cache/src/Backend/Factory.php on line 62

after switching from php 8.0 to php 8.1.

The corresponding configuration in config.ini.php is like this.

[RedisCache]
unix_socket = "/run/redis/redis-server.sock"
timeout = "1.5"
database = 2

Changing in Factory.php $redis->connect($options['unix_socket'], null, $timeout); to $redis->connect($options['unix_socket'], '0', $timeout); made this error disappear.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugFor errors / faults / flaws / inconsistencies etc.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions