Skip to content

Fix - Correct retrieval of 0 feature values via DB driver#143

Merged
taylorotwell merged 1 commit intolaravel:1.xfrom
pocketninja:fix-feature-with-int-zero-value-when-not-cached
Jul 7, 2025
Merged

Fix - Correct retrieval of 0 feature values via DB driver#143
taylorotwell merged 1 commit intolaravel:1.xfrom
pocketninja:fix-feature-with-int-zero-value-when-not-cached

Conversation

@pocketninja
Copy link
Contributor

Proposed fix for Issue #142

When a stored value for a feature is 0 (JSON "0"), $filtered->value('value') internally makes a loose comparison of "0" == true, resulting in no matches being found.

null is then passed into json_decode(), triggering the following:

   DEPRECATED  json_decode(): Passing null to parameter #1 ($json) of type string is deprecated in vendor/laravel/pennant/src/Drivers/DatabaseDriver.php on line 161.


   JsonException  Syntax error.

Issue was reproduced with tests pre-solve.

The fix assumes that if $filtered has records which match the provided $feature and $scope it can just grab the value directly from ->first() - that would typically have one result I believe.

@taylorotwell taylorotwell merged commit dce52a8 into laravel:1.x Jul 7, 2025
12 checks passed
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

Successfully merging this pull request may close these issues.

2 participants