-
Notifications
You must be signed in to change notification settings - Fork 717
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
strftime deprecated in PHP 8.1 #672
Comments
The strftime deprecation was actually a bit controversial where the RFC author voted against it ;-) Also the benefit of deprecating was debated on the internals list, see: https://externals.io/message/113657 Anyway, is this also an issue for Smarty 3? |
|
Well, when checking for the prevalence of strftime in Smarty 3 I found it in the following files:
Probably the same for Smarty 2. |
Thank you for your report. We'll fix this in due time. But let's get a PHP8.0 release out first :) |
See #678 |
@wisskid Thank you! |
I see that 4.x is moving very quickly with PHP 8.1 updates. |
@mambax7 I have no such intentions, but feel free to provide a PR! |
So is Smarty 2.x now officially "Abandonware"? |
@mambax7 no, Smarty has a v3 and a v4 you could upgrade to. |
I understand that, but is Smarty 2.x now officially "Abandonware"? |
@mambax7 I don't think you can call a specific version "abandonware". But semantics aside: support for v2 has been very limited over the past years and I don't see that improving. Since this is getting off-topic: maybe you could start a Discussion at https://github.com/smarty-php/smarty/discussions if you want to discuss the pros/cons of supporting v2 (and v3?) further into the future? |
This is how I see it: If 2.x is officially not anymore supported, then I agree with you - let's make an official announcement that 2.x is NOT supported anymore, and then people can start a Discussion at https://github.com/smarty-php/smarty/discussions about it I think, it's important that we have a clear situation and no misunderstandings about the status of 2.x |
It's a legacy version, it won't receive compatibility update anymore. You should use smarty v4 now. |
@mambax7 please see https://github.com/smarty-php/smarty/blob/master/SECURITY.md for our current policy as regarding to security support. Smarty 2 is officially not getting security support. We'll try to keep Smarty 3 usable and secure for the time being. New features (such as support for newer PHP-versions) are for Smarty 4+. |
Thanks for the clarification! |
I had some time and took another look at the issue here. From comments in #678 it sounded like relying on The biggest issue I found with the approach is that the formatting syntax is markedly different between strftime() and IntlDateFormatter::format - as an example One alternative I came across was another BC bridge like this one: https://gist.github.com/bohwaz/42fc223031e2b2dd2585aab159a20f30 or the package/repo derived from it: https://packagist.org/packages/php81_bc/strftime. These replace the old strftime function with a custom implementation which uses IntlDateFormatter under the hood with a translation table for converting the formatting syntax. That approach has worked well enough in my testing so far so it could be an option to add that as another composer dependency, or implement a similar fix directly in this project. @wisskid what are your thoughts on this? Is the syntax change acceptable switching to IntlDateFormatter, or would another BC layer be better? |
I was hoping for someone to implement a BC layer for strftime, so yes, using that would seem to be the best way forward. Changing the syntax is a no go, as far as I’m concerned. It would require developers thousands of hours to update templates.
Thank you for your thoughts and investigation
Simon
… Op 18 jun. 2022 om 06:38 heeft Mark Fettig ***@***.***> het volgende geschreven:
I had some time and took another look at the issue here. From comments in #678 it sounded like relying on IntlDateFormatter with symfony/polyfill-intl-icu as a fallback was the most interesting path forward so I tested some with that combination
The biggest issue I found with the approach is that the formatting syntax is markedly different between strftime() and IntlDateFormatter::format - as an example %D for strftime is m/d/Y for IntlDateFormatter. I expect that would be a pretty drastic change for a lot of existing code.
One alternative I came across was another BC bridge like this one: https://gist.github.com/bohwaz/42fc223031e2b2dd2585aab159a20f30 or the package/repo derived from it: https://packagist.org/packages/php81_bc/strftime. These replace the old strftime function with a custom implementation which uses IntlDateFormatter under the hood with a translation table for converting the formatting syntax. That approach has worked well enough in my testing so far so it could be an option to add that as another composer dependency, or implement a similar fix directly in this project.
@wisskid what are your thoughts on this? Is the syntax change acceptable switching to IntlDateFormatter, or would another BC layer be better?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.
|
https://packagist.org/packages/php81_bc/strftime seems like a great bridge to solve the strftime compatibility issue, but it requires the Intl extension, so now Smarty requires the Intl extension, so that is a breaking change and a new major release. Smarty 5 would be born and we'd have to maintain an extra version just to be able to suppress deprecation notices. symfony/polyfill-intl-icu could fill this gap, but it only supports the 'en' locale, so that doesn't really help all that much. So, for now, I propose people read https://stitcher.io/blog/dealing-with-deprecations and relax while we wait for a PHP9 release candidate. When PHP9 arrives, we'll release Smarty v5 and use whatever we now by then to make the transition as smooth as possible. |
Hello Simon, Month after month, notices about deprecated functions come back to pollute the bugtracker. Maybe it would be good to release a minor version to silence these notices, instead of constantly bothering you while waiting for PHP 9. I admire your patience. Regards, |
@lkppo thank you for your admiration ;) |
The text was updated successfully, but these errors were encountered: