Skip to content

Handle empty API keys with no-op client#135

Draft
marandaneto wants to merge 1 commit intomainfrom
fix/noop-empty-api-key
Draft

Handle empty API keys with no-op client#135
marandaneto wants to merge 1 commit intomainfrom
fix/noop-empty-api-key

Conversation

@marandaneto
Copy link
Copy Markdown
Member

Summary

  • initialize PostHog with a disabled no-op consumer when the API key is missing, null, empty, or trim-empty
  • avoid sending capture/flag requests with an empty api_key
  • add focused coverage for PostHog::init() and direct Client construction

Tests

  • ./vendor/bin/phpunit --no-coverage --filter 'testInitWithoutApiKeyConfiguresNoOpClient|testInitWithEmptyApiKeyConfiguresNoOpClient|testInitWithWhitespaceApiKeyConfiguresNoOpClient|testClientWithNullApiKeyDoesNotSendRequests|testClientWithTrimEmptyApiKeyDoesNotSendRequests' test/PostHogTest.php\n- ./vendor/bin/phpunit --no-coverage (completed with existing warnings/deprecations)

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 8, 2026

This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, post a comment or remove the stale label – otherwise this will be closed in another week.

@github-actions github-actions Bot added the stale label May 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant