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

In constructor can I assign database index instead of call select() function? #2563

Open
2 tasks done
victorxtx opened this issue Oct 7, 2024 · 2 comments
Open
2 tasks done

Comments

@victorxtx
Copy link

Expected behaviour

I tried to assign database index like below:
$redis = new Redis([
'host' => REDIS_HOST,
'auth' => REDIS_AUTH,
'db' => 3
]);
Then, I checked the doc of constructor, it acted as it is...

Actual behaviour

Sure enought, __construct(): Skip unknown option 'db'
and I have to call:
$redis->select(3); -- And of course it worked.

-- I'm lookking forward if this option can be added to the constructor.
-- Thank you all.

I'm seeing this behaviour on

  • OS: ubuntu 22.04
  • Redis: 7.2.0
  • PHP: 8.3.11
  • phpredis: 6.0.2

Steps to reproduce, backtrace or example script

Just like part I.

I've checked

  • There is no similar issue from other users
  • Issue isn't fixed in develop branch
@michael-grunder
Copy link
Member

I don't think you can choose the db in the connection array, although I suppose it could be added.

@victorxtx
Copy link
Author

I don't think you can choose the db in the connection array, although I suppose it could be added.

So, can it be taken into account?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants