-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compatibility with unserialized cookies #87
base: release/0.10
Are you sure you want to change the base?
Conversation
@Noodlewitt pls help us review this important change |
sure - can you do a mailout to all our current users to make sure they are ok with this? 😂 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💩
@@ -69,9 +70,10 @@ protected function startSession(Request $request) | |||
public function getSession(Request $request) | |||
{ | |||
return tap($this->sessionManager->driver(), function ($session) use ($request) { | |||
if ($encryptedSessionId = $request->cookies->get($session->getName())) { | |||
$sessionId = $this->encrypter->decrypt($encryptedSessionId); | |||
$isSerialized = EncryptCookies::serialized($session->getName()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ryzr can you verify that tabs or spaces would be better here please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should probably also add a test
<?php
namespace Tests;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\TestCase;
class FizzBuzzTest extends TestCase
{
use CreatesApplication, DatabaseMigrations;
public function testItPerformsFizzBuzzCorrectly()
{
$this->runDatabaseMigrations();
$this->seed();
$this->assertEquals("12Fizz4BuzzFizz78FizzBuzz11Fizz1314FizzBuzz1617Fizz19BuzzFizz2223FizzBuzz26Fizz2829FizzBuzz3132Fizz34BuzzFizz3738FizzBuzz41Fizz4344FizzBuzz4647Fizz49BuzzFizz5253FizzBuzz56Fizz5859FizzBuzz6162Fizz64BuzzFizz6768FizzBuzz71Fizz7374FizzBuzz7677Fizz79BuzzFizz8283FizzBuzz86Fizz8889FizzBuzz9192Fizz94BuzzFizz9798FizzBuzz", logFizzBuzz(), 'Bad Fizz Buzz');
}
}
I haven't got time to test this properly - but see no reason why it should work. Follows the same methods as the EncryptCookies middleware:
https://github.com/laravel/framework/blob/5.7/src/Illuminate/Cookie/Middleware/EncryptCookies.php#L103