Skip to content

Incompatibility with PHP 7.4 caused by TWIG #2129

@tareksamni

Description

@tareksamni

Expected behavior

I had a WP website that was running perfectly on 7.1 and when moved to 7.4 a lot of whitespaces in twig templates started to disappear and break HTML everywhere around the website.

After some investigation, I found that TWIG has an issue with PHP 7.4 concerning whitespaces that got fixed with:
twigphp/Twig@1fb0f97 in 1.41.0 (2019-05-14)

Actual behavior

I expect whitespaces in twig templates to print as whitespaces in rendered HTML.

Steps to reproduce behavior

As

<header class="header {% do action('header_class') %}"></header>

Should render to:

<header class="header fixed"></header>

Instead, it is rendered as:

<header class="headerfixed"></header>

What version of WordPress, PHP and Timber are you using?

WordPress 5.2.3, PHP 7.4, Timber 1.0.5

How did you install Timber? (for example, from GitHub, Composer/Packagist, WP.org?)

Composer

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions