launchdarkly/php-server-sdk

Error when providing PHP Redis client to PHPRedisFeatureRequester

CameronHall opened this issue · 4 comments

Describe the bug
When providing an instance of the PHP-Redis client to PHPRedisFeatureRequester, it'll still try and set it up as if you were providing the array of options to configure it.

This is because this condition fails:

if (isset($this->_options['phpredis_client']) && $this->_options['phpredis_client'] instanceof Redis) {

Similarly so does this one:
if ($this->_redisInstance instanceof Redis) {

This is because the conditions are checking against Redis under the LaunchDarkly\Impl\Integrations. So instead of checking if the provided client is an instance of Redis, it's checking if it's an instance of LaunchDarkly\Impl\Integrations\Redis. Prefixing Redis with a backslash will resolve the issue.

To reproduce
Provide a preconfigured PHP Redis client object like so:

LaunchDarkly\Integrations\PHPRedis::featureRequester(['phpredis_client' => $redis]);

Then try to fetch your feature flag list.

Expected behaviour
It should work 😄

Logs
N/A

SDK version
The version of this SDK that you are using.

Language version, developer tools
SDK Version 3.9

OS/platform
N/A

Thanks for catching this. Looking now.

@eli-darkly any chance we can get a new patch release sometime soon?

@CameronHall - Yes, sorry, it was held up last week by unrelated release deadlines.

@CameronHall Version 3.9.1 is released with this fix.