fix(flags): align local string matching with the flags service - #236
fix(flags): align local string matching with the flags service#236marandaneto wants to merge 5 commits into
Conversation
posthog-php Compliance ReportDate: 2026-08-27 06:46:44 UTC ✅ All Tests Passed!46/46 tests passed Capture Tests✅ 29/29 tests passed View Details
Feature_Flags Tests✅ 17/17 tests passed View Details
|
Prompt To Fix All With AI### Issue 1
composer.json:20
**Iconv becomes mandatory**
If a PHP 8.2+ installation lacks `ext-iconv`, requiring `symfony/polyfill-mbstring` makes Composer reject the installation even when native `ext-mbstring` is available, so environments that previously satisfied the SDK's declared requirements can no longer install or upgrade it.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Reviews (1): Last reviewed commit: "fix(flags): use simple Unicode lowercase..." | Re-trigger Greptile |
|
|
|
|
|
|
|
|
💡 Motivation and Context
Local feature flag evaluation did not match the
/flagsservice for several case-insensitive string comparisons. Exact matching used ASCII-only lowercasing, integral floats such as323.0lost their decimal suffix, andnot_icontainstreated a match at offset zero as no match.This fixes PostHog/posthog#78019 by:
exactandis_not, including array membershipicontains, prefix, and suffix operators on the existing ASCII-only lowercase pathstrposcomparison fornot_icontainssymfony/polyfill-mbstringandsymfony/polyfill-iconvso Unicode lowercase conversion works without either native extension, including context-independent sigma and U+0130 expansion semanticsA patch changeset is included for
posthog-php.💚 How did you test it?
vendor/bin/phpunit --no-coverage test/FeatureFlagLocalEvaluationTest.php- 120 tests and 2,578 assertions passedvendor/bin/phpunit --no-coverage- 479 tests and 3,904 assertions passedvendor/bin/phpcs --warning-severity=0- no errorscomposer validate --no-check-publish- valid, with the existing package version warningcomposer api:check- public API snapshot is up to dateext-mbstringandext-iconvdisabledPHPUnit reported existing warnings and deprecations, but no test failures.
📝 Checklist
If releasing new changes
pnpm changeto generate a change intent file🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Implemented with Pi using the PR and autoreview skills. The reviews identified scientific float formatting, contextual Greek sigma behavior, and the missing
MB_CASE_LOWER_SIMPLEconstant without native mbstring. These were fixed with regression coverage. Exact matching uses native simple lowercase when available and the polyfill’s context-independent lowercase mapping otherwise, with explicit U+0130 expansion to match the Rust backend.