Zend framework 3 session not working

I am trying to configure the zend framework 3 MVC application to use session storage. Following the information from this site -

https://olegkrivtsov.imtqy.com/using-zend-framework-3-book/html/en/Working_with_Sessions/PHP_Sessions.html

Everything works well. I get the session variable in my controller, and I can save the data in the session container just fine. The problem is that the data that I save in the container is NOT there on subsequent calls. I save the search criteria from one page and redirect to the second page to perform a search and return the results. Session data is missing when entering the second page.

In config \ global.php I have -

return [
    'session_config' => [
        // Cookie expires in 1 hour
        'cookie_lifetime' => 60*60*1,
        // Stored on server for 30 days
        'gc_maxlifetime' => 60*60*24*30,
        ],
    'session_manager' => [
        'validators' => [
            RemoteAddr::class,
            HttpUserAgent::class,
            ],
        ],
    'session_storage' => [
        'type' => SessionArrayStorage::class,
    ],
];

In application \ module.php I changed onBoostrap

public function onBootstrap(MvcEvent $event)
{
    $application = $event->getApplication();
    $svcMgr = $application->getServiceManager();

    //  Instantiate the session manager and
    //  make it the default one
    //
    $sessionManager = $svcMgr->get(SessionManager::class);
 }

I created an IndexControllerFactory

class IndexControllerFactory implements FactoryInterface
{
    public function __invoke(ContainerInterface $container,
                             $requestedName, array $options = null)
    {
        // Get access to session data
        //
        $sessionContainer = $container->get('Books\Session');
        return new IndexController($sessionContainer);
    }
}

IndexController

class IndexController extends AbstractActionController
{
    private $session;

    public function __construct(Container $session)
    {
        $this->session = $session;
    }

\module.config.php

'controllers' => [
    'factories' => [
        Controller\IndexController::class => Controller\Factory\IndexControllerFactory::class,
    ],
],
'session_containers' => [
    'Books\Session'
],
+4
1

- , :

// Create a session container
$container = new Container('Books\Session');
$container->key = $value;

- , :

// Retrieve from session container
$container = new Container('Books\Session');
$value = $container->key;

, ZF2 ZF3 fooobar.com/questions/1139789/... , , Zend Framework 2.

Container , , .

, AbstractContainer::__construct 72. $manager null, setManager.

, , .

, .

+2

Source: https://habr.com/ru/post/1663274/