Laminas MVC upgrade from ZF3 and to PHP8.2

141 Views Asked by At

Questions:

  1. Has anyone used Laminas MVC components on PHP8.2 without depracted warnings?
  2. What's the best way to adjust the session settings when migrating.

Issue: using Laminas Migrate and upgrading PHP (7.4 to 8.2) the system throws errors and crashes

"Fatal error: Uncaught Laminas\Session\Exception\InvalidArgumentException: 'session.cookie_lifetime' is not a valid sessions-related ini setting."

The system uses ZF3 MVC and zf-commons/zfc-user but the issue is sessions and other deprecated warnings when upgrading.

The issue is triggered in config/autoload/global.php

return [
// Session configuration.
    'session_config' => [
        // Session cookie will expire in 1 hour.
         'cookie_lifetime' => 60*60*1,
        // Session data will be stored on server maximum for 30 days.
        'gc_maxlifetime'     => 60*60*24*30,
    ],

Code in /Application/Module.php

 public function onBootstrap($e) {
        :
        $sessionManager =  $e->getApplication()->getServiceManager()->get('Zend\Session\SessionManager');
        
        try {
            $sessionManager->start();
            return;
        } catch (\Exception $e) {
            session_unset();
        }

Any tips, pointers or experience with updating Zf2/ZF3 to laminas would be greatly appreciated.

0

There are 0 best solutions below