Skip to content

fix: infer CLI SSL from host protocol#133

Merged
marandaneto merged 1 commit intomainfrom
fix/cli-infer-http-host-ssl
Apr 28, 2026
Merged

fix: infer CLI SSL from host protocol#133
marandaneto merged 1 commit intomainfrom
fix/cli-infer-http-host-ssl

Conversation

@marandaneto
Copy link
Copy Markdown
Member

💡 Motivation and Context

Fixes #25 for the bin/posthog CLI.

The CLI always passed an explicit ssl option, defaulting to true unless --no-ssl was provided. That prevented PostHog::init() from inferring ssl=false from http:// hosts, so local HTTP hosts still required --no-ssl.

💚 How did you test it?

  • php -l bin/posthog
  • vendor/bin/phpcs bin/posthog
  • vendor/bin/phpunit --do-not-fail-on-warning --do-not-fail-on-deprecation --do-not-fail-on-phpunit-warning --do-not-fail-on-phpunit-deprecation --filter 'testInitWithHttpHostSetsSslFalse|testInitWithWhitespacePaddedHttpHostSetsSslFalse|testInitWithHttpsHostSetsSslTrue|testInitWithEnvHttpHostSetsSslFalse' test/PostHogTest.php
  • Verified manually against a local HTTP server that php bin/posthog --type capture --apiKey key --distinctId id --event ev --properties '{}' --host http://127.0.0.1:<port> --debug sends POST /batch/ without --no-ssl.

📝 Checklist

  • I reviewed the submitted code.
  • I added tests to verify the changes.
  • I updated the docs if needed.
  • No breaking change or entry added to the changelog.

If releasing new changes

  • Added the release label to the PR
  • Added exactly one version bump label: bump-patch, bump-minor, or bump-major

@marandaneto marandaneto merged commit e90b7e0 into main Apr 28, 2026
16 checks passed
@marandaneto marandaneto deleted the fix/cli-infer-http-host-ssl branch April 28, 2026 16:11
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.

posthog-php does not respect http protocol

2 participants