-
Notifications
You must be signed in to change notification settings - Fork 2k
fix: default values for Session Redis Handler #6614
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
Conversation
MGatner
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really great test case! One change to consider.
| '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, | ||
| 'database' => preg_match('#database=(\d+)#', $matches[3], $match) ? (int) $match[1] : 0, | ||
| 'timeout' => preg_match('#timeout=(\d+\.\d+)#', $matches[3], $match) ? (float) $match[1] : 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be 0.0?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the regex should also be updated to check for int timeouts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
| { | ||
| parent::setUp(); | ||
|
|
||
| if (! class_exists(Redis::class)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about moving this to setUpBeforeClass? Or, using a class docblock instead, like @requires extension redis?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, thanks. It is better.
Done.
Make the same as Cache Redis config. See https://github.com/codeigniter4/CodeIgniter4/blob/ed0cdd00eaf20f7d6efb373af991111ead4fece8/app/Config/Cache.php#L155-L161
The timeout is float.
328fa6c to
d97d217
Compare
MGatner
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👌
| */ | ||
| class RedisHandler extends BaseHandler | ||
| { | ||
| private const REDIS_DEFAULT_PORT = 6379; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| private const REDIS_DEFAULT_PORT = 6379; | |
| private const DEFAULT_PORT = 6379; |
What about RedisHandler::DEFAULT_PORT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, REDIS_ is not needed.
Done.
Description
Fixes #6512
Make the same as Cache Redis config.
CodeIgniter4/app/Config/Cache.php
Lines 155 to 161 in ed0cdd0
Ref, https://github.com/phpredis/phpredis#php-session-handler
Checklist: