Skip to content

Comments

Fix infinite loop caused by null directive callback return#32

Merged
calebporzio merged 1 commit intomainfrom
fix/directive-callback-null-return
Feb 17, 2026
Merged

Fix infinite loop caused by null directive callback return#32
calebporzio merged 1 commit intomainfrom
fix/directive-callback-null-return

Conversation

@calebporzio
Copy link
Contributor

Summary

  • The callbacks in Directives::get() and Directives::has() had no return statement, implicitly returning null
  • This null propagated through BladeCompiler::compileStatements()replaceFirstStatement(), where strlen(null) evaluated to 0, preventing the offset from advancing — causing an infinite loop during view compilation
  • Fixed by adding return ''; to both callbacks

Test plan

  • Confirmed site hangs indefinitely on first load after php artisan view:clear without fix
  • Confirmed site loads in ~0.5s with fix applied

🤖 Generated with Claude Code

…ack return

The callbacks in Directives::get() and Directives::has() had no return
statement, implicitly returning null. This null propagated through
BladeCompiler::compileStatements() → replaceFirstStatement(), where
strlen(null) evaluated to 0, preventing the offset from advancing and
causing an infinite loop during view compilation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@calebporzio calebporzio merged commit 2e97a3a into main Feb 17, 2026
6 checks passed
@calebporzio calebporzio deleted the fix/directive-callback-null-return branch February 17, 2026 22:39
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