Skip to content
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

function strftime is deprecated (php 8.1) #784

Open
hannob opened this issue Aug 7, 2022 · 5 comments
Open

function strftime is deprecated (php 8.1) #784

hannob opened this issue Aug 7, 2022 · 5 comments

Comments

@hannob
Copy link
Contributor

hannob commented Aug 7, 2022

With PHP 8.1 I'm getting these warnings in the log:

PHP Deprecated:  Function strftime() is deprecated in [path]/include/functions.inc.php on line 143

The use of the strftime function is discouraged and will likely be removed in future PHP versions:
https://www.php.net/strftime

@garvinhicking
Copy link
Member

Sadly don't have much time these days, but I'd suggest to use a polyfill to make it work again. Adjusting to the immutalbe DateTime Interface for legacy application is a major pain.

Example for a polyfill: https://bestofphp.com/repo/alphp-strftime

That could be copy+pasted to serendipity_compat.inc.php or something like that, and be a drop-in replacement...? @onli

@onli
Copy link
Member

onli commented Aug 14, 2022

Using the polyfill sounds like a good idea to me!

@surrim
Copy link
Contributor

surrim commented Nov 23, 2022

Sadly don't have much time these days, but I'd suggest to use a polyfill to make it work again. Adjusting to the immutalbe DateTime Interface for legacy application is a major pain.

It seems it's quite a lot of work. There is another format for the date() function, no way to reuse the format strings in all translations without a polyfill.

@surrim
Copy link
Contributor

surrim commented Jan 31, 2023

Example for a polyfill: https://bestofphp.com/repo/alphp-strftime

That could be copy+pasted to serendipity_compat.inc.php or something like that, and be a drop-in replacement...? @onli

Works fine! 💃‍
I implemented that here, but it's not ready for merging because of other bugs.

@surrim surrim mentioned this issue Feb 10, 2023
@onli
Copy link
Member

onli commented Sep 6, 2023

I think we can almost close this.

The polyfill works and is merged. I tested it now under PHP 8.2, 8.1, 8.0 and 7.4 - seemed completely fine.

However, on my test server I ran into the issue that PHPs intl extension was not installed. The fix was:

apt install php-intl
service apache 2 restart

But we need to add this to the documentation, the installer, and should also mention it in the upgrade notice for the next version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants