launchdarkly/php-server-sdk

Warning: json_decode() expects parameter 1 to be string, array given

tiagobutzke opened this issue · 0 comments

Steps to reproduce

  • Using LDDFeatureRequester try to fetch all flags by a user:
$client = new LDClient(
    '...key',
    ['feature_requester_class' => 'LaunchDarkly\LDDFeatureRequester', ...]
);
$user = new LDUser(...);
$client->allFlags($user);

Warning

  • Warning: json_decode() expects parameter 1 to be string, array given

Analysis

  • Here it's using predis' hgetall(). This method returns an array;
  • Here the SDK is trying to decode $raw, but $raw is an array not a string.

Propose

  • Iterate the array and decode only it's rows;