timber
timber copied to clipboard
PHP8.1 | Deprecated: Return type compatibility
With PHP 8.1...
Deprecated: Return type of Timber\QueryIterator::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in
vendor/timber/timber/lib/QueryIterator.php on line 137
Deprecated: Return type of Timber\QueryIterator::next() should either be compatible with Iterator::next(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in
vendor/timber/timber/lib/QueryIterator.php on line 150
Deprecated: Return type of Timber\QueryIterator::key() should either be compatible with Iterator::key(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in
vendor/timber/timber/lib/QueryIterator.php on line 156
Deprecated: Return type of Timber\QueryIterator::valid() should either be compatible with Iterator::valid(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /
vendor/timber/timber/lib/QueryIterator.php on line 133
Deprecated: Return type of Timber\QueryIterator::rewind() should either be compatible with Iterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in
vendor/timber/timber/lib/QueryIterator.php on line 152
Deprecated: Return type of Timber\QueryIterator::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in
vendor/timber/timber/lib/QueryIterator.php on line 202
Deprecated: Return type of Timber\PostsIterator::current() should either be compatible with ArrayIterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in
vendor/timber/timber/lib/PostsIterator.php on line 12
What version of WordPress, PHP and Timber are you using?
PHP 8.1, Timber 1.19.1
How did you install Timber?
Composer
composer.json php version also needs to be bumped to allow php8
@jarednova is there any existing PR's to allow php8.1? This is blocking us from upgrading a few projects via composer.
Not sure there's some plan to support PHP 8.1 in Timber 1.x and I'm pretty sure there won't be any. It will require extra work/time we will preferably put in 2.x that is around the corner.
I'm already using 2.x on some production sites. Depending on the features you use, It's pretty stable enough and has support for PHP 8.0 (and 8.1 even there are still discussions over this).
Issue is we have quite a few sites using 1 and there is quiet a lot of work involved to upgrade all of them.
As far as I can see Timber isn't having any issues in php8. Are there bugs you are aware of @nlemoine
I'm already using 2.x on some production sites. Depending on the features you use, It's pretty stable enough and has support for PHP 8.0 (and 8.1 even there are still discussions over this).
hey @nlemoine, which release / branch / tag are you getting v2 from? is it advised to use the official alpha release or can we stay updated directly from the latest branch commit?
thank you for the advice!
@nlemoine how far is v2 coming out of alpha? We can't use v2 while it's in alpha and we're stuck on php7 if Timber v1 doesn't support php 8.
@trsteel88 I have no view on the release schedule or what's left to do. Maybe @gchtr or @jarednova could provide you more details.
@trsteel88 we continue to move through as quickly as possible. Unfortunately, life, kids, work and everything else can get in the way of the open source time I (wish!) I had. Based on the progress this week though, you can expect at least a fresh alpha release so we can keep making progress!
A new alpha release is now published:
https://github.com/timber/timber/releases/tag/2.0.0-alpha.5
Expect another one soon once we merge #2592
@jarednova there really needs to be updates to the 1.x release for PHP 8.0 at the very least. PHP 7.4 is EOL as of this coming November. If there can't be a release of 2.x well in advance of the EOL then we are putting all of our sites at risk as PHP 7.4 will receive no security updates.
@jarednova there really needs to be updates to the 1.x release for PHP 8.0 at the very least. PHP 7.4 is EOL as of this coming November. If there can't be a release of 2.x well in advance of the EOL then we are putting all of our sites at risk as PHP 7.4 will receive no security updates.
I agree, at this stage we will be looking to fork v1 and upgrade it. There doesn't seem to be an appetite for it to be completed within this repository.
There is now a pull request to add php 8.1 compatibility to Timber 1: https://github.com/timber/timber/pull/2640
@jarednova and @nlemoine is there anything we can do to help with this merge request?
It will be there soon: https://github.com/timber/timber/pull/2638
Timber 1.x will be supporting PHP 8.0/8.1 almost as soon as the PR above is merged. We're just missing some final approval from @jarednova or @palmiak
We just released a new version 1.21.0 that adds support for PHP 8.0 and 8.1: https://github.com/timber/timber/releases/tag/1.21.0.
It will soon be published to the WordPress plugin repository as well.
hi @gchtr, do we have any information when the new version will be available on Wordpress plugin repository?
Please be reticent with releasing to the Wordpress repo. This will trigger a lot of auto updates, and breaking sites while these two bugs are open:
https://github.com/timber/timber/issues/2655 https://github.com/timber/timber/issues/2654
Using the latest 1.22.1 version of Timber (in plugin version) + PHP 8.2, I'm still experiencing:
Deprecated: Return type of Twig\Node\Node::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /app/plugins/timber-library/vendor/twig/twig/src/Node/Node.php
It seems related to the bundled Twig 1.x inside vendor/.
Using composer, it works as expected.
Timber 1.x only officially supports PHP 8.0, not 8.1 or newer. I hope 2.x is out by the time PHP 8.0 is no longer supported.