Finish audit process cleanup: retire extract() idiom, harden cache flushing - #619
Merged
Merged
Conversation
Remaining items from the audit process cleanup: - FilterInjectorTransformer::rewrite() reads its options through typed array access instead of static locals populated via extract() - MagicConstantTransformer deduplicates the constructor and on-demand path bootstrap into one configurePaths() helper - CachePathManager flushes pending cache records from a shutdown function registered at construction, while the runtime environment is still intact; the destructor stays as a safety net and neither path can propagate an exception out of teardown Fixes #610 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WFMYyvE4hYRUoMS8mtKrHP
lisachenko
force-pushed
the
claude/php85-framework-audit-js2kzq
branch
from
August 29, 2026 12:43
0d7414d to
9f92bc8
Compare
lisachenko
marked this pull request as ready for review
August 29, 2026 12:45
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.
Summary
The remaining process-cleanup items from the PHP 8.5 audit (one commit).
FilterInjectorTransformer::rewrite(): thestatic $appDir, $cacheDir, $debug;locals populated viaextract(self::$options, EXTR_IF_EXISTS)are replaced with typed array reads of the set-onceself::$options(KernelOptionsshape guarantees the keys) — analyzable by PHPStan, no variable materialization magic.MagicConstantTransformer: the duplicated constructor / on-demand path bootstrap is deduplicated into oneconfigurePaths()helper; behavior identical (the on-demand path is still required becauseresolveFileName()runs from woven code where no transformer object exists).CachePathManager: pending cache records are now flushed from a shutdown function registered at construction, which runs while the runtime environment is still fully intact — instead of relying solely on__destruct(), whose ordering during shutdown is unspecified. The destructor remains as a safety net for managers released mid-request, and both teardown paths go throughflushSilently(): an exception escaping a destructor or shutdown callback would be fatal, while losing one cache write just means the next request re-weaves. ExplicitflushCacheState()calls keep their normal error behavior.SourceTransformingLoader's set-once statics were reviewed and left as-is: a PHP stream filter is instantiated by the engine itself, so static collaborators wired inensureRegistered()are inherent to the mechanism, and they are already typed and documented.Issue #618 (lazy-ghost evaluation for constructor interception) is deliberately not part of this PR — it stays open as a decision item with an evaluation plan on the issue.
Test evidence
php8.5 vendor/bin/phpunitphp8.4 vendor/bin/phpunitphp8.5/php8.4 vendor/bin/phpstan analyze(level 10)php8.6 vendor/bin/phpunit(informational, 8.6.0beta2)Fixes #610