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

Migrate from deprecated strftime to IntlDateFormatter #42

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

nielsrune
Copy link
Contributor

@nielsrune nielsrune commented Feb 7, 2025

What are the changes about?

Since PHP 8.1 (November 2021) strftime has been deprecated and will be removed in the future.

This edit replaces all calls to that function with IntlDateFormatter::format()

Note that this requires the Intl extension which may not be installed by default.

The custom function periodeoverskrifter() has been greatly reduced, since it was never called with a non-default value to $periode_laengde="regnskabsmaaned"

Further relevant info:

Have you checked the following?

@logicguy1
Copy link
Contributor

Hi Niels,

I just tested your PR but it seems to fail with the following error

[Mon Feb 10 10:48:17.866993 2025] [php:error] [pid 597:tid 597] [client 127.0.0.1:53296] PHP Fatal error: Uncaught Error: Class "IntlDateFormatter" not found in /srv/http/saldi/includes/finansfunk.php:25\nStack trace:\n#0 /srv/http/saldi/finans/regnskab.php(340): periodeoverskrifter()\n#1 {main}\n thrown in /srv/http/saldi/includes/finansfunk.php on line 25, referer: http://localhost:8080/saldi/index/main.php

@nielsrune
Copy link
Contributor Author

As mentioned, make sure Intl is installed and enabled. It comes bundled with PHP but may be disabled by default.

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

Successfully merging this pull request may close these issues.

2 participants