Geeklog-Core / geeklog

Geeklog - The Secure CMS.
https://www.geeklog.net
25 stars 19 forks source link

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

Closed eSilverStrike closed 2 years ago

eSilverStrike commented 2 years ago

Geeklog and many plugins including but not necessarily limited to:

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

mystralkk commented 2 years ago

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 commented 2 years ago

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

mystralkk commented 2 years ago

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

mystralkk commented 2 years ago

Done with mediagallery

eSilverStrike commented 2 years ago

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

eSilverStrike commented 2 years ago

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