Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP Fatal error after PHP upgrade (8.0 or higher) #2687

Closed
Castiblanco opened this issue Dec 5, 2022 · 5 comments
Closed

PHP Fatal error after PHP upgrade (8.0 or higher) #2687

Castiblanco opened this issue Dec 5, 2022 · 5 comments

Comments

@Castiblanco
Copy link

Hi, I am upgrading PHP on this website since we are using PHP 7.4, however, once I go to PHP 8.0+ I get a Fatal error and I see this on the error log:

PHP Fatal error:  Uncaught Error: Undefined constant "ENV" in /dom42117/wp-content/plugins/timber-library/vendor/twig/twig/src/Extension/CoreExtension.php:1661
Stack trace:
#0 /dom42117/wp-content/plugins/timber-library/vendor/twig/twig/src/Extension/CoreExtension.php(1661): constant('ENV')
#1 /dom42117/wp-content/plugins/timber-library/vendor/twig/twig/src/Environment.php(497) : eval()'d code(30): twig_constant('ENV')
#2 /dom42117/wp-content/plugins/timber-library/vendor/twig/twig/src/Template.php(453): __TwigTemplate_53e9d8e1532f224322e40f11d9628ced0ef859351326ec40020691e39bf7212b->doDisplay(Array, Array)
#3 /dom42117/wp-content/plugins/timber-library/vendor/twig/twig/src/Template.php(420): Twig\Template->displayWithErrorHandling(Array, Array)
#4 /dom42117/wp-content/plugins/timber-library/vendor/twig/twig/src/Environment.php(497) : eval()'d code(84): Twig\Template->display(Array)
#5 /dom42117/wp-content/plugins/timber-library/vendor/twig/twig/src/Template.php(453): __TwigTemplate_463bbf3a9ad038b5ee00f4f934eb82c973c950e04f16fdf7b490be87ad3d210b->doDisplay(Array, Array)
#6 /dom42117/wp-content/plugins/timber-library/vendor/twig/twig/src/Template.php(420): Twig\Template->displayWithErrorHandling(Array, Array)
#7 /dom42117/wp-content/plugins/timber-library/vendor/twig/twig/src/Environment.php(497) : eval()'d code(35): Twig\Template->display(Array, Array)
#8 /dom42117/wp-content/plugins/timber-library/vendor/twig/twig/src/Template.php(453): __TwigTemplate_6117eef2967e4024a8ddd13d22f98637553697006029f77f64e8511beda77b5b->doDisplay(Array, Array)
#9 /dom42117/wp-content/plugins/timber-library/vendor/twig/twig/src/Template.php(420): Twig\Template->displayWithErrorHandling(Array, Array)
#10 /dom42117/wp-content/plugins/timber-library/vendor/twig/twig/src/Environment.php(497) : eval()'d code(31): Twig\Template->display(Array)
#11 /dom42117/wp-content/plugins/timber-library/vendor/twig/twig/src/Template.php(453): __TwigTemplate_1412182097d0a23bc5f170f22c3537c40d9efcdedeb01625fc6e0e9929b2a5d5->doDisplay(Array, Array)
#12 /dom42117/wp-content/plugins/timber-library/vendor/twig/twig/src/Template.php(420): Twig\Template->displayWithErrorHandling(Array, Array)
#13 /dom42117/wp-content/plugins/timber-library/vendor/twig/twig/src/Template.php(432): Twig\Template->display(Array)
#14 /dom42117/wp-content/plugins/timber-library/vendor/twig/twig/src/TemplateWrapper.php(47): Twig\Template->render(Array, Array)
#15 /dom42117/wp-content/plugins/timber-library/lib/Loader.php(79): Twig\TemplateWrapper->render(Array)
#16 /dom42117/wp-content/plugins/timber-library/lib/Timber.php(334): Timber\Loader->render('page.twig', Array, false, 'default')
#17 /dom42117/wp-content/plugins/timber-library/lib/Timber.php(383): Timber\Timber::compile(Array, Array, false, 'default', true)
#18 /dom42117/wp-content/plugins/timber-library/lib/Timber.php(410): Timber\Timber::fetch(Array, Array, false, 'default')
#19 /dom42117/wp-content/themes/accedian/page.php(70): Timber\Timber::render(Array, Array)
#20 /wordpress-versions/6.1.1/wp-includes/template-loader.php(106): include('/dom42117/wp-co...')
#21 /wordpress-versions/6.1.1/wp-blog-header.php(19): require_once('/wordpress-vers...')
#22 /wordpress-versions/6.1.1/index.php(17): require('/wordpress-vers...')
#23 {main}
  thrown in /dom42117/wp-content/plugins/timber-library/vendor/twig/twig/src/Extension/CoreExtension.php on line 1661

WordPress 6.1.1, PHP 8.0, Timber 1.22.1

Thanks!

@joworeiter
Copy link

Timber 1.22 doesn't work with PHP 8.

@Castiblanco
Copy link
Author

Timber 1.22 doesn't work with PHP 8.

Is there a workaround? that is the latest version of that plugin https://wordpress.org/plugins/timber-library/ so I wonder if there is a fix or alternative? Thanks!

@joworeiter
Copy link

The only way to work with PHP8 and Timber would be to upgrade to Timber 2.0 beta.
But you have to keep in mind, that version 2.0 dropped the plugin support, so you would have to install it directly in your theme, prefered via composer.

@rmens
Copy link
Contributor

rmens commented Jan 7, 2023

Timber 1.22.1 should support PHP 8.0. It was added in 1.21.0 (https://github.com/timber/timber/releases/tag/1.21.0). PHP 8.1 support was removed. The Wordpress plug-in ships Twig 1.44.7 which should have PHP 8 support too. Can you check which Twig version you have installed?

@Levdbas
Copy link
Member

Levdbas commented Mar 21, 2023

Stale + couldn't reproduce for a site that I had still running on the plugin version.

@Levdbas Levdbas closed this as not planned Won't fix, can't repro, duplicate, stale May 12, 2023
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

No branches or pull requests

4 participants