Skip to content

Clear the static called class when a static extension method throws - #262

Merged
LukeTowers merged 1 commit into
wintercms:wip/1.3from
austinderrick:fix/extendable-static-called-class
Oct 16, 2026
Merged

LukeTowers merged 1 commit into
wintercms:wip/1.3from
austinderrick:fix/extendable-static-called-class

Conversation

@austinderrick

Copy link
Copy Markdown
Contributor

Summary

ExtendableTrait::extendableCallStatic() sets $extendableStaticCalledClass on the extension before forwarding a static call, and clears it afterward. When the extension method throws, the clear never runs, so the property keeps the caller's class name for later static calls in the process. The clear now runs in a finally block.

Split out of #241 so it can be reviewed on its own.

Testing

testStaticCalledClassIsClearedWhenAStaticExtensionMethodThrows in tests/Extension/ExtendableTraitTest.php fails without the change.

extendableCallStatic() set $extendableStaticCalledClass before forwarding the call and cleared it afterward. An exception from the extension skipped the clear, so the property kept the caller's class name for every later static call in the process. The clear now runs in a finally block.
@coderabbitai

coderabbitai Bot commented Oct 15, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a1073fa1-2d38-4362-8c02-32430904f6ac

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@LukeTowers
LukeTowers merged commit 084e10c into wintercms:wip/1.3 Oct 16, 2026
10 checks passed
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.

2 participants