Skip to content

Make sure invocations via blackfire use the same container#4925

Merged
ondrejmirtes merged 1 commit into
phpstan:2.1.xfrom
staabm:cont2
Feb 14, 2026
Merged

Make sure invocations via blackfire use the same container#4925
ondrejmirtes merged 1 commit into
phpstan:2.1.xfrom
staabm:cont2

Conversation

@staabm

@staabm staabm commented Feb 14, 2026

Copy link
Copy Markdown
Contributor

analog #4924

refs phpstan/phpstan#14072

blackfire adds a ENV var

grafik
@staabm staabm marked this pull request as ready for review February 14, 2026 08:34
@phpstan-bot

Copy link
Copy Markdown
Collaborator

This pull request has been marked as ready for review.

@ondrejmirtes ondrejmirtes merged commit aa18181 into phpstan:2.1.x Feb 14, 2026
639 of 644 checks passed
@ondrejmirtes

Copy link
Copy Markdown
Member

Thank you!

@staabm staabm deleted the cont2 branch February 14, 2026 08:45
SanderMuller added a commit to SanderMuller/phpstan-src that referenced this pull request Jun 24, 2026
The container cache key included the entire environment (minus a hand-maintained
denylist - phpstan#4924, phpstan#4925), so any unrelated env var that differs between invocations
(CI runners inject per-job vars on every run) flipped the key and forced a full
container recompile + ignoreErrors re-validation.

The container only depends on the environment through (a) %env.X% references in
loaded configs and (b) env read at build time by a CompilerExtension (PHPStan reads
only PHPSTAN_FNSR, in FnsrExtension::beforeCompile()). Keep exactly those env vars
in the cache key - the %env.NAME% names (matching Nette's %([\w.-]*)% grammar) plus
self::BUILD_TIME_ENV_VARIABLES - and drop the rest. The container parameters still
carry the full env, so %env.*% resolution is unaffected; this only narrows the key.

ContainerCacheKeyEnvGuardTest enforces that every env var read at build time by a
CompilerExtension is declared, so a future build-time getenv() cannot silently reuse
a stale container.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants