Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Message: Return type of CI_Session_files_driver::open($save_path, $name) should either be compatible with [duplicate]

I got this error after install a new xampp version (php8). and clone my codeigniter project.

Message: Return type of CI_Session_files_driver::open($save_path, $name)
should either be compatible with SessionHandlerInterface::open(string $path, string $name):
bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice

Filename: drivers/Session_files_driver.php

Line Number: 132

like image 609
Sandeep Himasha Avatar asked Sep 01 '25 22:09

Sandeep Himasha


1 Answers

For anyone else that comes across this error, I also experienced it after upgrading to PHP 8.1. The only way I could find to "fix" it was by adding #[\ReturnTypeWillChange] before the open, read, write, close, destroy and gc functions in /system/libraries/Session/drivers/Session_files_driver.php. For example:

#[\ReturnTypeWillChange]
public function open($save_path, $name)
{
...
like image 134
b4tch Avatar answered Sep 05 '25 04:09

b4tch