Skip to content

Fix latent bugs surfaced by the legacy-code audit - #1035

Open
mglaman wants to merge 1 commit into
mainfrom
audit/1c-latent-fixes
Open

Fix latent bugs surfaced by the legacy-code audit#1035
mglaman wants to merge 1 commit into
mainfrom
audit/1c-latent-fixes

Conversation

@mglaman

@mglaman mglaman commented Aug 5, 2026

Copy link
Copy Markdown
Owner

Part 4 of 9 in the legacy-code audit stack (on top of #1034). Small latent bugs surfaced by auditing the oldest code (2018–2019).

What changed

  • ExtensionDiscovery::sort(): extensions under an unknown profiles/ directory left holes in the origins/profiles arrays, making array_multisort() fail on unequal array sizes.
  • Extension::parseInfo(): missing closing quote in the exception message.
  • EntityFieldsViaMagicReflectionExtension: throw PHPStan's ShouldNotHappenException instead of a bare LogicException so failures surface as internal errors with context.
  • PluginManagerSetsCacheBackendRule: return no errors instead of throwing when outside a class, and delete the dead $cacheKey block whose result was never read.
  • DiscouragedFunctionsRule: drop 'eval' — it is a language construct and never parses as a function call.

Testing

Full suite, self-analysis, and phpcs are green.

🤖 Generated with Claude Code

@mglaman
mglaman force-pushed the audit/1c-latent-fixes branch from bd2e6fc to 8c90f35 Compare August 5, 2026 17:15
@mglaman
mglaman force-pushed the audit/1c-latent-fixes branch from 8c90f35 to 33d7c0f Compare August 5, 2026 19:13
Base automatically changed from audit/1b-include-hardening to main August 5, 2026 19:33
- ExtensionDiscovery::sort(): extensions under an unknown profiles/
  directory left holes in the origins/profiles arrays, making
  array_multisort() fail on unequal array sizes.
- Extension::parseInfo(): missing closing quote in the exception message.
- EntityFieldsViaMagicReflectionExtension: throw PHPStan's
  ShouldNotHappenException instead of LogicException so failures are
  reported as internal errors with context.
- PluginManagerSetsCacheBackendRule: return no errors instead of
  throwing when outside a class, and delete the dead $cacheKey block
  whose result was never read.
- DiscouragedFunctionsRule: drop 'eval' — it is a language construct
  and never parses as a function call.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@mglaman
mglaman force-pushed the audit/1c-latent-fixes branch from 33d7c0f to f7189dd Compare August 5, 2026 19:33
@mglaman
mglaman marked this pull request as ready for review August 5, 2026 19:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant