On a Ubuntu 18 package install instance, running PHP version 8.4.5, I just noticed today that emails weren’t sending and the cron.error.log
shows:
PHP Fatal error: Declaration of Cake\Chronos\Traits\FactoryTrait::createFromTimestamp(int $timestamp, $tz = null): Cake\Chronos\ChronosInterface must be compatible with DateTimeImmutable::createFromTimestamp(int|float $timestamp): static in /usr/share/php/passbolt/vendor/cakephp/chronos/src/Traits/FactoryTrait.php on line 339
$timestamp
is declared as an integer:
/**
* Create a ChronosInterface instance from a timestamp
*
* @param int $timestamp The timestamp to create an instance from.
* @param \DateTimeZone|string|null $tz The DateTimeZone object or timezone name the new instance s>
* @return static
*/
public static function createFromTimestamp(int $timestamp, $tz = null): ChronosInterface
{
$instance = static::now($tz)->setTimestamp($timestamp);
if (get_class($instance) === ChronosDate::class) {
trigger_error(
'2.5 Creating Date instances with createFromTimestamp() will be removed in 3.0',
E_USER_DEPRECATED
);
}
return $instance;
}
But here is set to float
:
Changing the source code on createFromTimestamp()
to mixed
or int|float
type permits functioning again, but it’s a change in the source code. Any thoughts on the conflict?