Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: launchdarkly/openfeature-php-server
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 2.1.0
Choose a base ref
...
head repository: launchdarkly/openfeature-php-server
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 2.1.1
Choose a head ref
  • 2 commits
  • 5 files changed
  • 3 contributors

Commits on Nov 12, 2026

  1. fix: Report a type mismatch for non-numeric flag values (#29)

    Numeric flag resolution now accepts only numeric flag values, and
    converts them to the requested type.
    
    - `is_numeric` accepted numeric *strings*, so a flag whose value is
    `"5"` was returned as a string from `resolveIntegerValue`. The
    OpenFeature client's `getIntegerValue(): int` then threw a `TypeError`
    internally, which it swallows per spec requirement 1.4.9 and reports as
    error code `GENERAL` — instead of the `TYPE_MISMATCH` the provider
    should have reported.
    - Values are now cast, so an integer flag resolves to an `int` (a float
    is truncated) and a float flag to a `float`, rather than passing the raw
    JSON type through.
    - Matches the Python provider, so the same flag value behaves the same
    way across providers.
    
    <details>
    <summary>Implementation details</summary>
    
    ```php
    } elseif ($flagValueType == FlagValueType::INTEGER && (!is_int($value) && !is_float($value))) {
        return $this->mismatchedTypeDetails($defaultValue);
    ...
    if ($flagValueType == FlagValueType::INTEGER) {
        $value = (int) $value;
    } elseif ($flagValueType == FlagValueType::FLOAT) {
        $value = (float) $value;
    }
    ```
    
    Because the value is converted, the result handed to the details
    converter is a new `EvaluationDetail` carrying the converted value with
    the original variation index and reason.
    `EvaluationDetail::isDefaultValue()` is derived from the variation
    index, which is preserved, so the variant of the resolution details is
    unchanged.
    
    Found during the weekly OpenFeature provider audit.
    
    **Requirements**
    
    - [x] I have added test coverage for new or changed functionality
    - [x] I have followed the repository's [pull request submission
    guidelines](../blob/main/CONTRIBUTING.md#submitting-pull-requests)
    - [x] I have validated my changes against all supported platform
    versions
    
    **Related issues**
    
    None.
    
    **Describe the solution you've provided**
    
    The integer and float branches check `is_int`/`is_float` instead of
    `is_numeric`, and the accepted value is cast to the requested type.
    Rejected values continue through the existing `mismatchedTypeDetails`
    path, so they report `TYPE_MISMATCH` with the default value.
    
    **Describe alternatives you've considered**
    
    Keeping `is_numeric` and casting numeric strings as well: that hides a
    genuinely mistyped flag instead of reporting it, and disagrees with the
    other providers.
    
    **Additional context**
    
    Testing: `make check` (`composer cs-check`, `composer phpstan`,
    `composer phpunit`). The existing type-matching data set gains
    numeric-string and non-integral-float cases and now asserts with
    `assertSame`, so the resolved type is checked and not just its loose
    value.
    
    </details>
    
    
    Link to Devin session:
    https://app.devin.ai/sessions/38a6eaf69fcf41109e136a1d0fe5e899
    Open in Devin Desktop:
    https://app.devin.ai/desktop/session/38a6eaf69fcf41109e136a1d0fe5e899?variant=devin
    Requested by: @kinyoklion
    
    [SDK-3288](https://launchdarkly.atlassian.net/browse/SDK-3288)
    
    <!-- CURSOR_SUMMARY -->
    ---
    
    > [!NOTE]
    > **Overview**
    > **Integer and float flag resolution** no longer treats numeric strings
    as valid: type checks use `is_int`/`is_float` instead of `is_numeric`,
    so a flag value like `"5"` now returns the default with
    **`TYPE_MISMATCH`** instead of a string that could surface as a
    **`GENERAL`** error inside the OpenFeature client.
    > 
    > Accepted numeric values are **cast** to the requested type (`int`
    truncates floats; `float` promotes ints), and the provider passes a new
    **`EvaluationDetail`** with the converted value while preserving
    variation index and reason.
    > 
    > Tests add numeric-string and float-to-int cases, switch type-matching
    assertions to **`assertSame`**, and cover **`valueForAll("5")`** for
    integer/float resolution errors.
    > 
    > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
    0685543. Bugbot is set up for automated
    code reviews on this repo. Configure
    [here](https://www.cursor.com/dashboard/bugbot).</sup>
    <!-- /CURSOR_SUMMARY -->
    
    
    [SDK-3288]:
    https://launchdarkly.atlassian.net/browse/SDK-3288?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
    
    Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
    kinyoklion and devin-ai-integration[bot] authored Nov 12, 2026
    Configuration menu
    Copy the full SHA
    a7d94cb View commit details
    Browse the repository at this point in the history

Commits on Nov 16, 2026

  1. chore(main): release 2.1.1 (#37)

    🤖 I have created a release *beep* *boop*
    ---
    
    
    ##
    [2.1.1](2.1.0...2.1.1)
    (2026-11-12)
    
    
    ### Bug Fixes
    
    * Report a type mismatch for non-numeric flag values
    ([#29](#29))
    ([a7d94cb](a7d94cb))
    
    ---
    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**
    > Cuts **release 2.1.1** by aligning version metadata across the repo:
    `Provider::VERSION`, `.release-please-manifest.json`, and the
    phpDocumentor title in the **build-docs** GitHub Action all move from
    **2.1.0** to **2.1.1**.
    > 
    > **CHANGELOG** adds the **2.1.1** section (2026-11-12), noting the bug
    fix that reports a **type mismatch** when numeric flag resolution
    receives **non-numeric** values ([#29]).
    > 
    > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
    77826a4. 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>
    github-actions[bot] authored Nov 16, 2026
    Configuration menu
    Copy the full SHA
    2c975e3 View commit details
    Browse the repository at this point in the history
Loading