fix: Check the deleted marker before decoding items from a persistent store - #266
Merged
Merged
Conversation
jsonbailey
reviewed
Aug 20, 2026
jsonbailey
approved these changes
Aug 20, 2026
jsonbailey
left a comment
Contributor
There was a problem hiding this comment.
Minor nit on the comments.
kinyoklion
marked this pull request as ready for review
August 20, 2026 18:21
kinyoklion
pushed a commit
that referenced
this pull request
Aug 24, 2026
🤖 I have created a release *beep* *boop* --- ## [6.8.3](6.8.2...6.8.3) (2026-08-20) ### Bug Fixes * Check the deleted marker before decoding items from a persistent store ([#266](#266)) ([a40614b](a40614b)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Overview** > Release Please version bump to **6.8.3**. > > Updates `LDClient::VERSION`, the release-please manifest, and the phpDocumentor title. Changelog notes the bugfix: check the deleted marker before decoding items from a persistent store (#266). > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit ac5b714. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
FeatureRequesterBasedecoded store items into theFeatureFlag/Segmentmodel before checking whether the item was a deleted-item tombstone. The model decoder readskey,on,salt,fallthrough, and other properties from the raw array with no defaults, understrict_types=1. A tombstone that does not carry the full schema therefore threw aTypeErrorduring decode.TypeErroris an\Error, so it escaped thecatch (\Exception)guard inLDClientand surfaced as an uncaught fatal in the application.Minimal tombstones are a realistic input: several other server SDKs write
{"version":N,"deleted":true}(with no key, and none of the other properties) to shared persistent stores when a flag or segment is deleted. With such a tombstone in the store:allFlagsState()fataled if the tombstone existed anywhere in the environment, even when the application never referenced the deleted flag.variation()/variationDetail()fataled when evaluating the deleted flag's key.This change checks the
deletedmarker on the raw JSON array ingetFeature,getSegment, andgetAllFeaturesbefore invoking the model decoder. Tombstones of any shape now behave as they should: the flag reads as not found andallFlagsState()skips it. Behavior for full-schema tombstones is unchanged, including the warning log on access.Verified against a real Redis store via the predis integration: with
{"version":9,"deleted":true}stored alongside live flags,allFlagsState()and evaluation of the deleted key both fataled before this change and now succeed, with the deleted key evaluating to the default value with aFLAG_NOT_FOUNDreason.SDK-2943
Note
Overview
Stops decoding store items into
FeatureFlag/Segmentbefore noticing they are tombstones. Incomplete{"version":N,"deleted":true}records from other SDKs previously caused aTypeError(uncaught byLDClient) onvariation()andallFlagsState().getFeature,getSegment, andgetAllFeaturesnow inspectdeletedon the raw JSON and treat those items as not found (with the existing warning on single-item access). Full-schema tombstones behave the same. Tests cover live items plus full and minimal tombstones.Reviewed by Cursor Bugbot for commit ca6a9bd. Bugbot is set up for automated code reviews on this repo. Configure here.