Merge pull request #11996 from Quix0r/fixes/get-relative-time-null-parameter

Fixed: "Argument 1 passed to Friendica\Util\Temporal::getRelativeDate() must be of the type string, null given"
This commit is contained in:
Hypolite Petovan 2022-10-18 12:33:51 -04:00 committed by GitHub
commit f3abef0979
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 3 deletions

View File

@ -311,13 +311,16 @@ class Temporal
*
* @return string with relative date
*/
public static function getRelativeDate(string $posted_date, string $format = null): string
public static function getRelativeDate(string $posted_date = null, string $format = null): string
{
$localtime = $posted_date . ' UTC';
if (empty($posted_date) || $posted_date <= DBA::NULL_DATETIME) {
return DI::l10n()->t('never');
}
$localtime = $posted_date . ' UTC';
$abs = strtotime($localtime);
if (is_null($posted_date) || $posted_date <= DBA::NULL_DATETIME || $abs === false) {
if ($abs === false) {
return DI::l10n()->t('never');
}