fix(flags): align local string matching with the flags service - #236
Conversation
posthog-php Compliance ReportDate: 2026-08-31 06:20:14 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 |
|
|
|
|
|
|
|
|
|
Addressed all four current-backend parity findings in signed commit
The full 481-test suite passes. The behavior matrix also passes on PHP 8.2, 8.3, 8.4, and Alpine PHP 8.3 with native mbstring/iconv disabled. This PR follows the released backend; PostHog/posthog#90694 remains the separate draft for changing the backend boolean and empty-array contract. |
💡 Motivation and Context
Local feature flag evaluation did not match the released
/flagsservice for exact comparisons, Unicode lowercase, or JSON value stringification.This fixes PostHog/posthog#78019 by:
is_notas the direct complement ofexactserde_jsonfor the same IEEE-754 valueicontains, prefix, and suffix operators on the existing ASCII-only lowercase pathstrposcomparison fornot_icontainssymfony/polyfill-mbstringandsymfony/polyfill-iconvfor installations without the native extensionsThe SDK intentionally follows the currently released backend. PostHog/posthog#90694 is a separate draft proposing more intuitive boolean and empty-array semantics. This SDK can follow that behavior if the backend proposal is accepted later.
A patch changeset is included for
posthog-php.💚 How did you test it?
JsonSerializablevendor/bin/phpunit --no-coverage- 481 tests and 3,966 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 datecomposer audit- no security advisoriesserde_jsonoutputPHPUnit reported existing warnings and deprecations, but no test failures.
📝 Checklist
If releasing new changes
posthog-php.🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Implemented with Pi using the address-pr-comments, check-pr, autoreview, and karpathy-guidelines skills. Autoreview found malformed UTF-8 and
JsonSerializablegaps, which were reproduced and fixed before push. A claim that PHP PCRE2 lacked the Final_Sigma Unicode properties was rejected after PHP 8.2, 8.3, 8.4, and Alpine runtime validation confirmed support.