Redis cache with unix socket and php 8.1

With Matomo 4.10.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.

This bug is still existent in Matomo 4.13.0.

This bug is still present in Matomo 4.13.1.

WARNING: /vendor/matomo/cache/src/Backend/Factory.php(62): Deprecated - Redis::connect(): Passing null to parameter #2 ($port) of type int is deprecated - Matomo 4.13.1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already) (Module: MultiSites, Action: index, In CLI mode: false)

Hi @whocarez
I created an issue in the Matomo GitHub repo for you:

The fix: