smarty icon indicating copy to clipboard operation
smarty copied to clipboard

PHP9 support (strftime)

Open wisskid opened this issue 3 years ago • 8 comments

strftime

Provide a wrapper for strftime (to be removed in PHP9), possibly using alphp/strftime. This will require a new major, since alphp/strftime requires ext-intl.

wisskid avatar Sep 22 '22 11:09 wisskid

Why try to emulate strftime() and for how long? You might as well align with PHP by offering two formatters [one for date() and another for Intl] or none.

saulery avatar Sep 04 '23 14:09 saulery

I think that there is definitely no need to depend on the !mandatory use of certain extensions such as 'ext-intl' and especially third-party libraries, there should be a way to implement this functionality without this for the new Smarty 5, this would be the best option. As a last resort, if the functionality for some reason cannot be implemented in full as before, which is unlikely, then it is necessary to check for the presence of this extensions and if it is not present, use a different implementation. Also the vast majority of template engines and even large frameworks do not require the use of any extensions to work correctly, which is correct and does not scare away some part of users.

eczio avatar Sep 04 '23 14:09 eczio

Please see https://github.com/smarty-php/smarty/issues/672#issuecomment-1159360142 and below. It's not as straightforward as you might think. But if you see a solution that does not require an extension, this would of course be preferred.

wisskid avatar Sep 05 '23 19:09 wisskid

Well, I hope that we can still find some solution without using an additional 'ext-intl' extension. In any case, I think it would be absolutely correct not to require it forcibly and if it is not present, for example, use an implementation similar with symfony/polyfill-intl-icu with only supports the 'en' locale or something else, it will be enough for the vast majority of users.

eczio avatar Sep 06 '23 16:09 eczio

Agree with lkppo, I think maybe it's time to get rid of strftime if it is not a must. Developers who still need strftime could polyfill it by themselves? (By reading some old issues & comments, I didn't figure out why strftime should be a must for new Smarty releases)

wxiaoguang avatar Feb 12 '24 10:02 wxiaoguang