Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Redis::connect(): Passing null to parameter #3 ($timeout) of type float is deprecated #6512

Closed
JasonSanYe opened this issue Sep 8, 2022 · 4 comments · Fixed by #6614
Labels
bug Verified issues on the current code behavior or pull requests that will fix them

Comments

@JasonSanYe
Copy link

PHP Version

8.1

CodeIgniter4 Version

4.2.6

CodeIgniter4 Installation Method

Composer (as dependency to an existing project)

Which operating systems have you tested for this bug?

macOS

Which server did you use?

fpm-fcgi

Database

No response

What happened?

将session 设置redis

php7.4正常

php8.1报错:Redis::connect(): Passing null to parameter #3 ($timeout) of type float is deprecated

image

Steps to Reproduce

将session 设置redis

php8.1 下

Expected Output

将session 设置redis

php8.1 下

Anything else?

No response

@JasonSanYe JasonSanYe added the bug Verified issues on the current code behavior or pull requests that will fix them label Sep 8, 2022
@kenjis
Copy link
Member

kenjis commented Sep 8, 2022

Please write in English.

@paulbalandan
Copy link
Member

Can you show your $sessionSavePath value in Config\App?

@hurtsky
Copy link

hurtsky commented Sep 11, 2022

I also having this problem while testing with redis. Im using .env with app.sessionSavePath = 'tcp://127.0.0.1:6379' with php8.1.
on php7.4 no ErrorException

@kenjis
Copy link
Member

kenjis commented Sep 11, 2022

@hurtsky Try:

--- a/system/Session/Handlers/RedisHandler.php
+++ b/system/Session/Handlers/RedisHandler.php
@@ -78,7 +78,7 @@ class RedisHandler extends BaseHandler
                 'port'     => empty($matches[2]) ? null : $matches[2],
                 'password' => preg_match('#auth=([^\s&]+)#', $matches[3], $match) ? $match[1] : null,
                 'database' => preg_match('#database=(\d+)#', $matches[3], $match) ? (int) $match[1] : null,
-                'timeout'  => preg_match('#timeout=(\d+\.\d+)#', $matches[3], $match) ? (float) $match[1] : null,
+                'timeout'  => preg_match('#timeout=(\d+\.\d+)#', $matches[3], $match) ? (float) $match[1] : 0.0,
             ];
 
             preg_match('#prefix=([^\s&]+)#', $matches[3], $match) && $this->keyPrefix = $match[1];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Verified issues on the current code behavior or pull requests that will fix them
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants