pantheon-systems / wp-redis

WordPress Object Cache using Redis.
https://wordpress.org/plugins/wp-redis/
GNU General Public License v2.0
225 stars 67 forks source link

[BUGS-6118] PHP Deprecation notice on passing port = null @ Redis::connect() #398

Closed pgnd closed 9 months ago

pgnd commented 1 year ago

i've installed,

wp-cli core version
    6.2

wp-cli cli info
    OS:     Linux 6.2.9-200.fc37.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Mar 30 22:31:57 UTC 2023 x86_64
    Shell:  /bin/bash
    PHP binary:     /usr/bin/php
    PHP version:    8.2.4
    php.ini used:   /usr/local/etc/php8/php.ini
    MySQL binary:   /usr/bin/mysql
    MySQL version:  mysql  Ver 15.1 Distrib 10.9.4-MariaDB, for Linux (x86_64) using  EditLine wrapper
    SQL modes:
    WP-CLI root dir:        phar://wp-cli.phar/vendor/wp-cli/wp-cli
    WP-CLI vendor dir:      phar://wp-cli.phar/vendor
    WP_CLI phar path:       /www/wp.app
    WP-CLI packages dir:
    WP-CLI cache dir:       /var/lib/wwwrun/.wp-cli/cache
    WP-CLI global config:
    WP-CLI project config:  /www/wp.app/wp-cli.yml
    WP-CLI version: 2.7.1

wp-cli plugin status wp-redis
    Plugin wp-redis details:
        Name: WP Redis
        Status: Active
        Version: 1.3.5
        Author: Pantheon, Josh Koenig, Matthew Boynes, Daniel Bachhuber, Alley Interactive
        Description: WordPress Object Cache using Redis. Requires the PhpRedis extension (https://github.com/phpredis/phpredis).

per @ https://github.com/pantheon-systems/wp-redis#user-content-installation, config is

$redis_server = [
    'host' => '/run/redis/redis.sock',
    'port' => null,
    'auth' => 'xxxxx',
    'database' => 0,
];

on each page access, in dev-mode logs,

[09-Apr-2023 13:16:58 UTC] PHP Deprecated:  Redis::connect(): Passing null to parameter #2 ($port) of type int is deprecated in /www/wp.app/web/app/plugins/wp-redis/object-cache.php on line 1242

where

cat object-cache.php
    ...
        public function prepare_client_connection( $client_parameters ) {
            if ( defined( 'WP_REDIS_USE_RELAY' ) && WP_REDIS_USE_RELAY ) {
                $redis = new Relay\Relay;
            } else {
                $redis = new Redis;
            }

1242        $redis->connect(
                $client_parameters['host'],
                $client_parameters['port'],
                // $client_parameters['timeout'] is sent in milliseconds,
                // connect() takes seconds, so divide by 1000
                $client_parameters['timeout'] / 1000,
                null,
                $client_parameters['retry_interval']
            );

            return $redis;
        }
    ...
stovak commented 1 year ago

Internal Tracking: https://getpantheon.atlassian.net/browse/BUGS-6118

pgnd commented 1 year ago

@stovak

after upgrade v1.3.5 to current

Plugin wp-redis details:
    Name: WP Redis
    Status: Active
-   Version: 1.4.1
+    Version: 1.4.2
    Author: Pantheon, Josh Koenig, Matthew Boynes, Daniel Bachhuber, Alley Interactive
    Description: WordPress Object Cache using Redis. Requires the PhpRedis extension (https://github.com/phpredis/phpredis).

still, logs fill with

[25-May-2023 13:05:29 UTC] PHP Deprecated:  Redis::connect(): Passing null to parameter #2 ($port) of type int is deprecated in /www/wp.app/web/app/plugins/wp-redis/object-cache.php on line 1291
hj-collab commented 1 year ago

@stovak Any update on this issue?

pgnd commented 9 months ago

@hj-collab

checking here, apparently still no ...

php -v
    PHP 8.2.10 (cli) (built: Aug 29 2023 15:31:38) (NTS gcc x86_64)
    Copyright (c) The PHP Group
    Zend Engine v4.2.10, Copyright (c) Zend Technologies
        with Zend OPcache v8.2.10, Copyright (c), by Zend Technologies
wp-cli core version
    6.3.1
wp-cli cli info | grep "CLI ver"
    WP-CLI version: 2.8.1
wp-cli plugin status wp-redis | grep "Ver"
    Deprecated: Redis::connect(): Passing null to parameter #2 ($port) of type int is deprecated in /srv/wp.app/web/app/plugins/wp-redis/object-cache.php on line 1299
        Version: 1.4.3
pgnd commented 9 months ago

6 months is enough; not holding my breath. Switching to other solution.