2

I add session and session-ext packages to a Mezzio project.

After that I get an error:

Too few arguments to function Mezzio\Session\SessionMiddleware::__construct(), 0 passed in /var/www/mezzio/vendor/mezzio/mezzio/src/MiddlewareContainer.php on line 57 and exactly 1 expected

I find that mezzio-session uses Zend-session and try to install Zend-session but this gives me an error too:

  • mezzio/mezzio-session-ext is locked to version 1.12.0 and an update of this package was not requested.
  • mezzio/mezzio-session 1.6.0 conflicts with zendframework/zend-expressive-session 1.3.0.
  • mezzio/mezzio-session-ext 1.12.0 requires mezzio/mezzio-session ^1.4 -> satisfiable by mezzio/mezzio-session[1.6.0].
  • Root composer.json requires zendframework/zend-expressive-session ^1.3 -> satisfiable by zendframework/zend-expressive-session[1.3.0].

How can I use mezzio-session and -session-ext in a Mezzio project?

Update 1:

I get this error on a route where I have used SessionMiddleware::class in the route pipeline as described here:

use Mezzio\Authentication\OAuth2;
use Mezzio\Session\SessionMiddleware;

$app->route('/oauth2/authorize', [
    SessionMiddleware::class,

    OAuth2\AuthorizationMiddleware::class,

    // The following middleware is provided by your application (see below):
    App\OAuthAuthorizationMiddleware::class,

    OAuth2\AuthorizationHandler::class
], ['GET', 'POST']);

0 Answers0