flyntwp / flynt

Component based WordPress starter theme, powered by ACF Pro and Timber, optimized for a11y and fast page load results.
https://flyntwp.com
MIT License
731 stars 83 forks source link

flynt 2.1.1 'Fatal Error' @ twig 3.10 deprecation in Timber src #554

Closed pgnd closed 6 months ago

pgnd commented 6 months ago

on an udpated install of Wordpress Flynt v2.1.1 theme, including Timber 2.x-dev

    wp-cli core version
        6.5.3

    php -v
        PHP 8.3.6 (cli) (built: Apr 10 2024 14:21:20) (NTS gcc x86_64)
        Copyright (c) The PHP Group
        Zend Engine v4.3.6, Copyright (c) Zend Technologies
            with Zend OPcache v8.3.6, Copyright (c), by Zend Technologies
            with Xdebug v3.3.2, Copyright (c) 2002-2024, by Derick Rethans

    yarn info test-flynt | head -n 3
    └─ test-flynt@workspace:.
       ├─ Version: 2.1.1
       │

    git log -n 1
          1 commit 790d6cc1ce7096a1d7e9222601f83a06ebfa87f0 (HEAD -> master, tag: v2.1.1, origin/master, origin/HEAD      1 )
          2 Author: Timo Hubois <info@pixelsaft.de>
          3 Date:   Fri May 10 16:05:38 2024 +0200
          4
          5     chore(release): 2.1.1

    composer show timber/timber
        name     : timber/timber
        descrip. : Create WordPress themes with beautiful OOP code and the Twig Template Engine
        keywords : templating, themes, timber, twig, wordpress
        versions : * 2.x-dev
        released : 2024-05-07, this week
        type     : library

    composer show twig/twig
        name     : twig/twig
        descrip. : Twig, the flexible, fast, and secure template language for PHP
        keywords : templating
        versions : * v3.10.0
        released : 2024-05-11, today
        type     : library
        ...

    wp-cli theme list
        +--------------------+----------+--------+---------+----------------+-------------+
        | name               | status   | update | version | update_version | auto_update |
        +--------------------+----------+--------+---------+----------------+-------------+
        | test-flynt         | active   | none   | 1.0.0   |                | off         |
        | twentytwentyfour   | inactive | none   | 1.1     |                | off         |
        +--------------------+----------+--------+---------+----------------+-------------+

on access to my site front-page, I see

( ! ) Fatal error: Uncaught LogicException: You must call "setEnvironment()" before calling "Twig\Extension\EscaperExtension::setEscaper()". in /srv/www/wp.app/web/app/themes/test-flynt/vendor/twig/twig/src/Extension/EscaperExtension.php on line 127

( ! ) LogicException: You must call "setEnvironment()" before calling "Twig\Extension\EscaperExtension::setEscaper()". in /srv/www/wp.app/web/app/themes/test-flynt/vendor/twig/twig/src/Extension/EscaperExtension.php on line 127

the call stack identifies,

.../Twig.php:558

    Twig\Extension\EscaperExtension->setEscaper( $strategy = 'esc_url', $callable = class Closure { } )

the source of the problem is a deprecation in just-released twig 3.10,

https://github.com/twigphp/Twig/blob/3.x/src/Extension/EscaperExtension.php#L127

filed upstream @ Timber,

"Fatal Error: Uncaught Logic Exception -- twig 3.10 deprecation @ timber/src/Twig.php" https://github.com/timber/timber/issues/2994

timohubois commented 6 months ago

@pgnd thanks for open the issue. Doing a clean installation with the latest release of flynt should use twig 3.9.2 https://github.com/flyntwp/flynt/blob/790d6cc1ce7096a1d7e9222601f83a06ebfa87f0/composer.lock#L651

You run into trouble only after updating an older Flynt installation and not using a clean installation of 2.1.1, aren't you?

The issue seem to be fixed in twig 3.10.1: https://github.com/timber/timber/issues/2993#issuecomment-2106771406

Can you confirm this?

pgnd commented 6 months ago

You run into trouble only after updating an older Flynt installation and not using a clean installation of 2.1.1, aren't you?

here, on a clean install, subsequently updated

Can you confirm this?

confirmed

with

composer show twig/twig | grep version
    versions : * v3.10.1

all good.

timohubois commented 6 months ago

@pgnd thanks for the reply. I think then the issue is not related to the release itself and can be closed. Do you object to this?

pgnd commented 6 months ago

@timohubois

nope, just informational at this point.