Skip to content

Commit 949165e

Browse files
committed
Merge branch '5.4' into 6.0
* 5.4: [Mime] Fix invalid DKIM signature with multiple parts Fix Command::run phpdoc Update Response.php [HttpFoundation] Fix TypeError on null `$_SESSION` in `NativeSessionStorage::save()`
2 parents b11e612 + 2bd5bb1 commit 949165e

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

Response.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class Response
7272
public const HTTP_PRECONDITION_REQUIRED = 428; // RFC6585
7373
public const HTTP_TOO_MANY_REQUESTS = 429; // RFC6585
7474
public const HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE = 431; // RFC6585
75-
public const HTTP_UNAVAILABLE_FOR_LEGAL_REASONS = 451;
75+
public const HTTP_UNAVAILABLE_FOR_LEGAL_REASONS = 451; // RFC7725
7676
public const HTTP_INTERNAL_SERVER_ERROR = 500;
7777
public const HTTP_NOT_IMPLEMENTED = 501;
7878
public const HTTP_BAD_GATEWAY = 502;

Session/Storage/NativeSessionStorage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ public function save()
223223
unset($_SESSION[$key]);
224224
}
225225
}
226-
if ([$key = $this->metadataBag->getStorageKey()] === array_keys($_SESSION)) {
226+
if ($_SESSION && [$key = $this->metadataBag->getStorageKey()] === array_keys($_SESSION)) {
227227
unset($_SESSION[$key]);
228228
}
229229

Tests/Session/Storage/NativeSessionStorageTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,4 +311,13 @@ public function testRegenerateInvalidSessionIdForNativeFileSessionHandler()
311311
$this->assertTrue($started);
312312
$this->assertSame('&~[', session_id());
313313
}
314+
315+
public function testSaveHandlesNullSessionGracefully()
316+
{
317+
$storage = $this->getStorage();
318+
$_SESSION = null;
319+
$storage->save();
320+
321+
$this->addToAssertionCount(1);
322+
}
314323
}

0 commit comments

Comments
 (0)