launchdarkly/php-server-sdk

Internal error preventing

buley opened this issue · 3 comments

buley commented

Couldn't get up and running using SDK docs: https://app.launchdarkly.com/default/production/quickstart#/install-sdk/php

[23-Sep-2016 06:44:31 UTC] CaughtError: /srv/www/wp-content/mu-plugins/platform/vendor/launchdarkly/launchdarkly-php/src/LaunchDarkly/FeatureFlag.php:33 -> Argument 4 passed to LaunchDarkly\FeatureFlag::__construct() must be of the type array, null given, called in /srv/www/wp-content/mu-plugins/platform/vendor/launchdarkly/launchdarkly-php/src/LaunchDarkly/FeatureFlag.php on line 67 and defined

I'm not sure what exactly are the prereqs that are referenced here but I'm guessing I'm missing something? https://github.com/launchdarkly/php-client/blob/36bedeeb96cfe0fa9e25b171c699facb8e1821fb/src/LaunchDarkly/FeatureFlag.php#L33

I've got very basic code:

$user = new \LaunchDarkly\LDUser($user_id);
$response = $this->client->variation($key, $user);

$ php -v
PHP 5.6.25 (cli) (built: Aug 31 2016 19:02:26)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies

$ catcomposer.json |grep dark
"launchdarkly/launchdarkly-php": "^2.0",

buley commented

apparently a missing a $key variable, w/no warning like when using a blank user key (87f37d4), crashes instead

Hi @buley -- did you mean to close this? I wasn't sure if the commit you referenced addressed your issue.

buley commented

@jkodumal I realized it was half-titled and half-explained, so I closed it thinking I looked like an idiot. There's probably a worthy issue in "check if requested feature key is null" but I seemed to have botched this one.