Thursday, February 3, 2022

Code update from PHP 7.4 to PHP 8.1 - Session_database_driver.php in CodeIgniter 3



system/libraries/Session/drivers/Session_database_driver.php 

Reference

https://github.com/bcit-ci/CodeIgniter/pull/6078/files

Severity: 8192

Message: Return type of CI_Session_database_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_database_driver.php

Line Number: 129

line 129 change

      public function open($save_path, $name)

to
        public function open(string $save_path, string $name): bool

line 282 change

      public function close()

to
      public function close(): bool

line 154 change

        public function read($session_id)

to

// the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice

     #[\ReturnTypeWillChange]
        public function read(string $session_id)

line 214

change

       public function write($session_id, $session_data)

to
        public function write(string $session_id, string $session_data): bool

line 307 change

      public function destroy($session_id)

to
        public function destroy(string $session_id): bool

line 347 change


         public function gc($maxlifetime)

to
        #[\ReturnTypeWillChange]
        public function gc(int $maxlifetime)

 

No comments:

Post a Comment