wp-packages-update-server
wp-packages-update-server copied to clipboard
Possible incorrect use of the function **date_i18n**
WP Plugin Update Server Version: 1.4.14 WP Version: 5.8
Possible incorrect use of the function date_i18n in wp-plugin-update-server/wp-plugin-update-server/integration-examples/dummy-theme/lib/wp-package-updater/
on line 445
Expected behavior: Outputs a message on WP Admin Dashboard that a license has expired. This message should include the expiration date.
Actual behavior: Outputs the current date of the day instead of the expiration date.
The use of date_i18n in /wp-package-updater/class-wp-package-updater.php on line 445:
date_i18n( get_option( 'date_format' ), $license_data->date_expiry )
is incorrect. According to WP code reference, the second parameter can´t be a date (string) but only int|bool:
date_i18n(
string $format,
int|bool $timestamp_with_offset = false,
bool $gmt = false )
Possible solution:
445: date_format( date_create( $license_data->date_expiry ), get_option( 'date_format' ) )
shows the correct expiration date.