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

strftime and gmstrftime depreciated as of PHP 8.1 - Need to find a replacement #1110

Closed
eSilverStrike opened this issue Jan 18, 2022 · 6 comments
Assignees
Labels
Improvement Code cleanup, Obsolete functions, or small changes to existing Features.
Milestone

Comments

@eSilverStrike
Copy link
Member

eSilverStrike commented Jan 18, 2022

Geeklog and many plugins including but not necessarily limited to:

  • Static Pages
  • Calendar
  • Forum
  • Media Gallery
  • Messenger

use strftime all over the place (and in some places gmstrftime)

We will need to switch in a replacement as these functions have been depreciated as of 8.1 and will be removed by PHP 9:

https://php.watch/versions/8.1/strftime-gmstrftime-deprecated#replacements

Some Geeklog vendor libraries like Oauth also use it.

Replacement or work around needs to work with PHP 5.6

@eSilverStrike eSilverStrike added the Improvement Code cleanup, Obsolete functions, or small changes to existing Features. label Jan 18, 2022
@eSilverStrike eSilverStrike added this to the 2.2.2 milestone Jan 18, 2022
@mystralkk
Copy link
Member

Basically, IntlDateFormatter::format () can output in four formats:

Type Date Time
IntlDateFormatter::FULL Tuesday, April 12, 1952 AD 3:30:42pm PST
IntlDateFormatter::LONG January 12, 1952 3:30:32pm
IntlDateFormatter::MEDIUM Jan 12, 1952
IntlDateFormatter::SHORT 12/13/52 3:30pm

We cannot get, for example, only the day or the month name using this function. We have full month names in $LANG_MONTH and full day names in $LANG_WEEK. How about adding $LANG_MONTH_SHORT (e.g. 'Jan'..'Dec') and $LANG_WEEK_SHORT (e.g. 'Mon'..'Sat') and using date() function?

mystralkk added a commit that referenced this issue Jan 19, 2022
mystralkk added a commit that referenced this issue Jan 19, 2022
@mystralkk
Copy link
Member

OK, I replaced strftime() with COM_strftime() and gmstrftime() with COM_gmstrftime(), using date() and items from language files.

@mystralkk mystralkk self-assigned this Jan 19, 2022
mystralkk added a commit that referenced this issue Jan 19, 2022
@mystralkk
Copy link
Member

Finished with Geeklog core, core plugins, messenger, and ban.

@mystralkk
Copy link
Member

Done with mediagallery

@eSilverStrike
Copy link
Member Author

That was a lot of work for you. I will update the forum to use your new functions.

@eSilverStrike
Copy link
Member Author

Forum now done. Also updated the GeSHI library to the latest version which had other PHP fixes as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Improvement Code cleanup, Obsolete functions, or small changes to existing Features.
Projects
None yet
Development

No branches or pull requests

2 participants