Session reset
FvsJ101 opened this issue · 4 comments
FvsJ101 commented
bryanjhv commented
Please try adding Session middleware first.
I'll try to do a demo showing that redirects don't clear session unless another package (or own code) calls any session_*
functions.
FvsJ101 commented
Hi Bryan,
You mean add it last as slim is LIFO? or other why?
Regards
Michael
…On Mon, Sep 30, 2019 at 9:32 PM Bryan Horna ***@***.***> wrote:
Please try adding Session middleware first.
I'll try to do a demo showing that redirects don't clear session unless
another package (or own code) calls any session_* functions.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#44?email_source=notifications&email_token=AC5Q6GFZY77U253MKALVD4DQMJH5LA5CNFSM4I3ZRA7KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD762LVA#issuecomment-536716756>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AC5Q6GHDR24IFAVRZS5BYKLQMJH5LANCNFSM4I3ZRA7A>
.
FvsJ101 commented
Hi Bryan,
Tried both ways, still not working.
Regards
Michael
…On Tue, Oct 1, 2019 at 4:47 PM Michael Meyer ***@***.***> wrote:
Hi Bryan,
You mean add it last as slim is LIFO? or other why?
Regards
Michael
On Mon, Sep 30, 2019 at 9:32 PM Bryan Horna ***@***.***>
wrote:
> Please try adding Session middleware first.
> I'll try to do a demo showing that redirects don't clear session unless
> another package (or own code) calls any session_* functions.
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <#44?email_source=notifications&email_token=AC5Q6GFZY77U253MKALVD4DQMJH5LA5CNFSM4I3ZRA7KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD762LVA#issuecomment-536716756>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AC5Q6GHDR24IFAVRZS5BYKLQMJH5LANCNFSM4I3ZRA7A>
> .
>
bryanjhv commented
Can't reproduce it.
{
"require": {
"slim/slim": "^4.2",
"bryanjhv/slim-session": "^4.0",
"slim/psr7": "^0.5.0"
}
}
require 'vendor/autoload.php';
use Slim\Factory\AppFactory;
use SlimSession\Helper as SessionHelper;
use Slim\Middleware\Session as SlimSession;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
$app = AppFactory::create();
$app->add(new SlimSession([
'name' => 'example',
'autorefresh' => true,
'lifetime' => '30 minutes',
'secure' => false,
'httponly' => true,
]));
$app->get('/', function (Request $request, Response $response) {
$helper = new SessionHelper();
$helper->set('hello', 'world');
$response->getBody()->write(json_encode($_SESSION));
return $response
->withHeader('Content-Type', 'application/json')
->withStatus(200);
});
$app->get('/dest', function (Request $request, Response $response) {
$response->getBody()->write(json_encode($_SESSION));
return $response
->withHeader('Content-Type', 'application/json')
->withStatus(200);
});
$app->get('/redir', function (Request $request, Response $response) {
return $response
->withHeader('Location', '/dest')
->withStatus(302);
});
$app->addErrorMiddleware(true, true, true);
$app->run();
Closing for lack of information and code to test.
Feel free to open a new issue adding that. Thanks.