Skip to content

View: Text nodes starting with "0" clear their parent element and stop rendering of following element nodes #1824

@ek9r

Description

@ek9r

Tempest version

2.14.0

PHP version

8.4

Operating system

Linux

Description

When an element contains a text node whose content starts with the character "0", the Tempest view parser behaves incorrectly.

  1. The text content of the element is removed, leaving the element empty.
  2. Rendering then stops entirely, causing all following element nodes to be skipped and not rendered.

This results in incomplete output, even though the input markup is valid and contains no dynamic expressions.

Steps to reproduce

Test Environment

  • using the default TempestPHP application scaffold: tempest-app
    (composer create-project tempest/app)
  • Minimal modification: home.view.php adapted with the example markup
  • Tempest version: 2.14.0
  • PHP versions: 8.4.15 + 8.5.0 (packages.sury.org)
  • Composer version: 2.9.2
  • Operating system: Linux Debian GNU/Linux 13 (trixie)

Example
Input

<!-- home.view.php -->
<x-base>
  <h1>0 breaks rendering</h1>
  <h2>1 is never rendered</h2>
</x-base>

Output

<body>
  <h1></h1>
</body>

Control Example
Input

<!-- home.view.php -->
<x-base>
  <h1> 0 no longer breaks rendering</h1>
  <h2>1 is still rendered</h2>
</x-base>

Output

<body>
  <h1> 0 no longer breaks rendering</h1>
  <h2>1 is still rendered</h2>
</body>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions