![]() |
Hi,
i trie to setup/install codeigniter4, for the moment i recieved this error. "Fatal error: Declaration of CodeIgniter\I18n\TimeTrait::createFromTimestamp(int $timestamp, $timezone = null, ?string $locale = null) must be compatible with DateTimeImmutable::createFromTimestamp(int|float $timestamp): CodeIgniter\Autoloader\Autoloader in /var/www/vhosts/hosting116540.a2f7e.netcup.net/v2.4u.tools/httpdocs/system/I18n/TimeTrait.php on line 268" What i have to do?
Dont use php8.4
Framework supported php8.3 (11-20-2024, 01:01 PM)4usol Wrote: Hi, Update this method as follows : Code: public static function createFromTimestamp(int|float $timestamp, $timezone = null, ?string $locale = null)
i dont know ,i had some issues with time so did this :
in BaseController.php Code: namespace App\Controllers; then in any controller : Code: use CodeIgniter\I18n\Time; Code: 'date'=>$this->myDate and in view Code: <?php echo $date;?> Now since i use a single template for all views , i only need to do above for view once. I acknowledge i have not answered the question but may have thrown in some ideas
I just installed it for the first time. I got the same error.
I looked at both solution provided on this thread and noticed that the error specifically says. PHP Code: Declaration of CodeIgniter\I18n\TimeTrait::createFromTimestamp(int $timestamp, $timezone = null, ?string $locale = null) must be compatible with DateTimeImmutable::createFromTimestamp(int|float $timestamp): So I went to vendor/codeigniter4/framework/system/I18n/TimeTrait.php And changed the declaration on line 268 from PHP Code: public static function createFromTimestamp(int $timestamp, $timezone = null, ?string $locale = null) PHP Code: public static function createFromTimestamp(int|float $timestamp, $timezone = null, ?string $locale = null) I am not getting the error anymore. May not be a complete fix? But at least the home page of a fresh install loads now. |
Welcome Guest, Not a member yet? Register Sign In |