1
0
mirror of https://github.com/flarum/core.git synced 2025-10-13 07:54:25 +02:00

Use Illuminate Session component instead of Symfony

Symfony's component relies on PHP's native session functionality, which
is not ideal. It automatically sets its own cookie headers, resulting in
this issue: https://github.com/flarum/core/issues/1084#issuecomment-364569953

The Illuminate component is more powerful and has a simpler API for
extension with other drivers and such, and fits in nicely with other
components we use (the majority of which are from Illuminate).
This commit is contained in:
Toby Zerner
2018-02-10 12:04:07 +10:30
committed by Franz Liedke
parent b4e093ab8a
commit 5672819549
12 changed files with 91 additions and 38 deletions

View File

@@ -13,10 +13,10 @@ namespace Flarum\Http\Middleware;
use Flarum\User\Guest;
use Flarum\User\User;
use Illuminate\Contracts\Session\Session;
use Interop\Http\ServerMiddleware\DelegateInterface;
use Interop\Http\ServerMiddleware\MiddlewareInterface;
use Psr\Http\Message\ServerRequestInterface as Request;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
class AuthenticateWithSession implements MiddlewareInterface
{
@@ -33,7 +33,7 @@ class AuthenticateWithSession implements MiddlewareInterface
return $delegate->process($request);
}
private function getActor(SessionInterface $session)
private function getActor(Session $session)
{
$actor = User::find($session->get('user_id')) ?: new Guest;