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.