Fix @theme directive collision in health check view#60340
Merged
Conversation
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.
Problem
Any application that registers a custom
@themeBlade directive has that directive invoked while the framework compiles its own health check view (/up).health-up.blade.phpis compiled by Blade.Since #58344 switched it to Tailwind v4, the file contains:
@themehere is meant as Tailwind v4 CSS, read at runtime by@tailwindcss/browser@4. But Blade compiles the template first, andthemeis a valid custom-directive name. A directive's arguments are optional, so@theme {matches as that directive with an empty expression — and if an app has registered one (a documented feature), Blade replaces the token while compiling the framework's own view.Reproduction
Register a minimal
@themedirective in a service provider:Clear compiled views and open
/up:The
<style type="text/tailwindcss">block renders as:instead of:
Blade matched the Tailwind
@theme {at-rule as the directive and replaced it.Impact
This no-op directive just breaks the emitted CSS. Directives that build PHP from
$expression(e.g.@theme($name, ...)) produce invalid PHP for the empty match and return a 500 on/up.Fix
Escape the at-rule as
@@theme. Blade emits a literal@themeand no longer matches it as a directive; Tailwind receives the same CSS as before. No change to default installations.Notes
12.xas well (where Update tailwind version #58344 merged); same line is present on13.x.