Skip to content

Infinite Load When View Ends with Unclosed <?php Tag #1276

@basteyy

Description

@basteyy

Tempest version

1.0-alpha.6

PHP version

8.4

Operating system

Linux

Description

When a view template file ends with an open <?php tag (without the corresponding closing ?>), the application fails to render the view and the request hangs indefinitely, resulting in a perpetual loading state.

Suggested Fix

  • Detect unclosed PHP tags during view compilation or loading phase.
  • Throw a descriptive exception (e.g. UnclosedPhpTagException) indicating the file path and line number.
  • Fallback to a safe error page rather than hanging the request.
  • Optionally, integrate a linting step in the build/deployment pipeline to catch unclosed tags before runtime.
  • Or change code to work with not closed views.

Steps to reproduce

  • Create a new view file, for example app/example.view.php.
  • Insert the following content, leaving the PHP tag unclosed:
<?php
echo "Hello, world!";
// Note: No closing tag here
  • In your controller, return this view:
return View('example.view.php');
  • Access the corresponding URL in your browser.

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions