flatpressblog / flatpress

FlatPress is a lightweight, easy-to-set-up flat-file blogging engine.
https://flatpress.org
GNU General Public License v2.0
187 stars 57 forks source link

Update Smarty #390

Open azett opened 7 months ago

azett commented 7 months ago

With FlatPress 1.3.1, we ship Smarty 4.3.1. In the meantime, Smarty 4 has evolved to 4.5.2 (as of today) - and even Smarty 5 has been released.

With e544ed6, @Fraenkiman noted some errors on updating to Smarty 4.5. Needs to be inspected.

azett commented 7 months ago

With 2e36211, I updated to Smarty 4.5.2. The new function admin_register_smartyplugins() takes care of registering all neccessary modifiers for the admin templates. If another "Using the unregistered function "foo" in a template is deprecated" message pops up anywhere in the Admin Area, simply add the missing function name to the $functionsToRegister array.

Upgrading to Smarty 5 is still to be tackled, though - but we may discuss if this has any priority, since 4.5.2 works sufficiently on current PHP versions.

Fraenkiman commented 6 months ago

Hello everyone,

there will probably be an initial release for PHP8.4 around November 2024.

Therefore, the question can be derived: Which changes will result for Smarty and which for FlatPress?

The next question is: What are the advantages of Smarty 5 for FlatPress?

And last but not least: Do you wait until the last moment when you have to migrate to both Smarty and PHP or do you dedicate yourself to one promptly and have more time for the other later?

If you have to migrate FlatPress to both at the same time, the effort before an imminent deadline is very high - and you are under time pressure. If you can already play around with Smarty 5.x.x now, you should use the time, because you'll have to migrate at some point anyway.

In principle, however, I am in favor of linking the update cycle of FlatPress to the life cycle of PHP. The migration to the next Smarty version would then take place automatically.

In the case of Franah's ResposiveAdmin, I would immediately switch to Smarty 5. It doesn't make sense to first upgrade the ResposiveAdmin branch to Smarty 4 and then again to Smarty 5. You don't want to sacrifice that much free time.

I think the following sequence makes sense:

  1. update the current master branch to Smarty 5
  2. migration from Responsiveadmin to Smarty 5 -> Master branch
  3. if necessary migration to PHP8.4 and following

@azett, i would like to see an anniversary release on February 15, 2026. :grin: 🥳 .

Best regards and have a good night Frank

Fraenkiman commented 4 months ago

Hello everyone,

Laborix from the support forum did a quick & dirty test with FlatPress 1.3.1/ Smarty 4.3.1 using PHP8.4.0 alpha 1. The following hints flew around his ears:

PHP Deprecated:  Smarty_Internal_Method_GetTemplateVars::getTemplateVars(): Implicitly marking parameter $_ptr as nullable is deprecated, the explicit nullable type must be used instead in .../fp-includes/smarty-4.3.1/libs/sysplugins/smarty_internal_method_gettemplatevars.php on line 34
PHP Deprecated:  Smarty_Internal_Method_GetTemplateVars::_getVariable(): Implicitly marking parameter $_ptr as nullable is deprecated, the explicit nullable type must be used instead in .../fp-includes/smarty-4.3.1/libs/sysplugins/smarty_internal_method_gettemplatevars.php on line 87
PHP Deprecated:  Smarty_Internal_TemplateCompilerBase::compileTemplate(): Implicitly marking parameter $parent_compiler as nullable is deprecated, the explicit nullable type must be used instead in .../fp-includes/smarty-4.3.1/libs/sysplugins/smarty_internal_templatecompilerbase.php on line 386
PHP Deprecated:  Smarty_Internal_TemplateCompilerBase::compileTemplateSource(): Implicitly marking parameter $parent_compiler as nullable is deprecated, the explicit nullable type must be used instead in .../fp-includes/smarty-4.3.1/libs/sysplugins/smarty_internal_templatecompilerbase.php on line 417
PHP Deprecated:  Smarty_Internal_Runtime_CodeFrame::create(): Implicitly marking parameter $compiler as nullable is deprecated, the explicit nullable type must be used instead in .../fp-includes/smarty-4.3.1/libs/sysplugins/smarty_internal_runtime_codeframe.php on line 28
PHP Deprecated:  Smarty_Resource_Custom::populate(): Implicitly marking parameter $_template as nullable is deprecated, the explicit nullable type must be used instead in .../fp-includes/smarty-4.3.1/libs/sysplugins/smarty_resource_custom.php on line 48

With best regards Frank

Fraenkiman commented 4 months ago

ToDo-list for Smarty 5 upgrade: https://smarty-php.github.io/smarty/stable/upgrading/#upgrading-from-v4-to-v5

Comment from laborix: Removed PHP constants The following constants have been removed to prevent global side effects. SMARTY_DIR see: https://smarty-php.github.io/smarty/stable/upgrading/

PHP 8.4: Implicitly nullable parameter declarations deprecated https://php.watch/versions/8.4/implicitly-marking-parameter-type-nullable-deprecated

Branch: https://github.com/flatpressblog/flatpress/tree/upgrading-from-smarty-v4-to-v5

Fraenkiman commented 1 day ago

Smarty 4 has made it into the PHP8.4 round with version 4.5.5. This clears the way for testing FlatPress for PHP 8.4 errors.