picocms / Pico

Pico is a stupidly simple, blazing fast, flat file CMS.
http://picocms.org/
MIT License
3.81k stars 615 forks source link

php 7.4 #534

Closed petermoo closed 4 years ago

petermoo commented 4 years ago

Is there a Twig compatible with PHP 7.4 and PicoCMS 2.1.1?

Deprecated: Unparenthesized `a ? b : c ? d : e` is deprecated. Use either `(a ? b : c) ? d : e` or `a ? b : (c ? d : e)` in vendor/twig/twig/lib/Twig/Node.php on line 42

Deprecated: Unparenthesized `a ? b : c ? d : e` is deprecated. Use either `(a ? b : c) ? d : e` or `a ? b : (c ? d : e)` in vendor/twig/twig/lib/Twig/Node.php on line 198
petermoo commented 4 years ago

A quick look at Twig 1, 2, and 3. Twig 3 requires PHP 7.2. Twig 2 requires PHP 7.0. PicoCMS version 2.1.1 requires PHP 5.3.6 and seems to work with PHP 7.4 except for the Twig problem. I will modify the Twig code and continue testing.

PhrozenByte commented 4 years ago

Instead of modifying Twig's source code, I'd rather recommend one of the following:

  1. Simply hide the deprecation notice. It's no error, it's just PHP telling you that Twig is kinda outdated, so you can safely ignore it. You can do the same as described in #528.

  2. Since the issues with our old dependencies kinda got out of hand lately (see #528 again :sweat_smile:), it's probably about time to kick-start the development of Pico 3.0. It likely won't get as big as described in #317, but the most important thing is upgrading Pico's dependencies. We'll likely upgrade to Twig 3 and Symfony YAML 5 and thus require PHP 7.2 in the future (but that's too much work for a quick fix). Since page loading still is an rather big issue with Pico we'll likely also go for lazy page discovery and loading. But that's it.

    Since you probably don't want to wait a few months, I've just created Pico v3.0.0-alpha.1. The only change is upgrading to Twig 2.12 and Symfony YAML 3.4 (thus it requires PHP 7.0.8+). Both are still officially supported and are mostly drop-in replacements ("mostly" means "should work for most users", there can still be some issues for you), since they maintain BC on a best-effort basis. Alpha 1 is meant as a fast solution for you, we'll upgrade to Twig 3 and Symfony YAML 5 later (which definitely will break BC). If you're going to try it out, please let me know about your experiences.

    Same is true for anyone else - feedback is highly appreciated! :heart:

petermoo commented 4 years ago

Fixed.