Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/auth/tests/SessionAuthenticatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ public function deauthenticate_regenerates_the_session_identifier_and_discards_t
$session->set(SessionAuthenticator::AUTHENTICATABLE_KEY, 1);
$session->set(SessionAuthenticator::AUTHENTICATABLE_CLASS, MemoizedAuthenticatable::class);
$session->set('key', 'value');

$sessionManager = new TestingSessionManager();

$authenticator = new SessionAuthenticator(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ private function resolveIterableData(iterable $model): array
$primaryKey = $this->model->getPrimaryKey();

if ($primaryKey !== null && $this->model->hasUuidPrimaryKey() && ! isset($entry[$primaryKey])) {
$entry = [$primaryKey => Random\uuid(), ...$entry];
return [$primaryKey => Random\uuid(), ...$entry];
}

return $entry;
Expand Down
5 changes: 4 additions & 1 deletion packages/http/src/Session/Managers/FileSessionManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,11 @@ public function deleteExpiredSessions(): void

foreach ($sessionFiles as $sessionFile) {
$lastActiveAt = @filemtime($sessionFile);
if ($lastActiveAt === false) {
continue;
}

if ($lastActiveAt === false || $lastActiveAt > $expiredBefore) {
if ($lastActiveAt > $expiredBefore) {
continue;
}

Expand Down
2 changes: 0 additions & 2 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
use Rector\Config\RectorConfig;
use Rector\EarlyReturn\Rector\Return_\ReturnBinaryOrToEarlyReturnRector;
use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector;
use Rector\Php70\Rector\StaticCall\StaticCallOnNonStaticToInstanceCallRector;
use Rector\Php74\Rector\Property\RestoreDefaultNullToNullableTypePropertyRector;
use Rector\Php81\Rector\Array_\ArrayToFirstClassCallableRector;
use Rector\Php81\Rector\FuncCall\NullToStrictStringFuncCallArgRector;
Expand Down Expand Up @@ -47,7 +46,6 @@
ReadOnlyPropertyRector::class,
AddSensitiveParameterAttributeRector::class,
RestoreDefaultNullToNullableTypePropertyRector::class,
StaticCallOnNonStaticToInstanceCallRector::class,
EncapsedStringsToSprintfRector::class,
PrivatizeFinalClassMethodRector::class,
IssetOnPropertyObjectToPropertyExistsRector::class,
Expand Down
3 changes: 3 additions & 0 deletions tests/Integration/Http/FileSessionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -283,13 +283,15 @@ public function unchanged_session_is_not_rewritten(): void

$session = $this->manager->getOrCreate($id);
$session->set('user', 'brent');

$this->manager->save($session);

$unchanged = $this->manager->getOrCreate($id);

// Another request writes to the same session in the meantime
$concurrent = $this->manager->getOrCreate($id);
$concurrent->set('cart', 'book');

$this->manager->save($concurrent);

$clock->plus(Duration::minutes(5));
Expand All @@ -309,6 +311,7 @@ public function last_active_at_is_read_from_modification_time(): void

$session = $this->manager->getOrCreate($id);
$session->set('user', 'brent');

$this->manager->save($session);

$clock->plus(Duration::minutes(5));
Expand Down
2 changes: 1 addition & 1 deletion tests/Integration/Http/ManageSessionMiddlewareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ private function handle(Session $session, ?Closure $controller = null, array $he
$middleware(
request: new GenericRequest(method: Method::GET, uri: '/', headers: $headers),
next: new HttpMiddlewareCallable(function () use ($session, $controller) {
if ($controller !== null) {
if ($controller instanceof Closure) {
$controller($session);
}

Expand Down
Loading