fix: omit null custom event property members - #241
Draft
marandaneto wants to merge 3 commits into
Draft
Conversation
Contributor
posthog-php Compliance ReportDate: 2026-09-09 11:01:37 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
|
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.
💡 Motivation and Context
Custom event properties currently keep null object members in outgoing batches and saved events. This implements the null-property policy from sdk-specs #60 at the PHP event serialization boundary.
The serializer removes null custom-property members recursively after PHP resolves
JsonSerializablevalues. It keeps array positions, empty objects, non-null values, caller data, and event-scoped exception and feature-flag metadata. File persistence, restored NDJSON, and CLI properties use the same object-preserving decoder, including NUL-prefixed keys.send.phpaccepts an optional host without changing its default. The public API snapshot adds only the two internal helpers. No dependencies or existing public signatures change.💚 How did you test it?
Fresh checks on PHP 8.5.10 at
8883f6e64677fa72600d1064f7b3b388bdb2a836:origin/maincompleted with TruffleHog clean and no findings.Final SHA-bound CI: all 21 checks passed on
8883f6e64677fa72600d1064f7b3b388bdb2a836, including hosted PHPUnit on PHP 8.2, 8.3, 8.4, and 8.5. No failed or pending checks remained at the final poll.This is a draft for human review, not release or universal conformance approval. The unsafe original full suite, ForkCurl gzip/background paths, minimum PHP runtime matrix, and performance checks were not run locally. Synchronous uncompressed ForkCurl was tested only through the guarded loopback fixture. Earlier audit runs had external file/ingestion/temp safety incidents whose prior state remains unknown. This continuation did not repeat or clean up those incidents. Shared compliance-harness gaps remain separate and passing CI does not establish complete null-policy conformance.
📝 Checklist
If releasing new changes
pnpm changeto generate a change intent fileA
posthog-php: patchintent was written manually in the existing.changesetformat. No package manager, installation, lifecycle script, version bump, or release command was run.🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Pi implemented and validated this change using Git, PHP/PHPUnit, PHP_CodeSniffer, the API checker, GitHub CLI, and the installed isolated autoreview helper. The human DRI is @marandaneto. No shareable session link is available.
The work keeps normalization at the existing event serialization boundary instead of adding caller-side filtering or a blanket metadata exemption. Native PHP encoding remains authoritative for custom serializers and rejection of invalid inputs. Human review is required. This draft must not be auto-merged or released by the agent.