Skip to content

Commit 86119d2

Browse files
Merge branch '6.0' into 6.1
* 6.0: Exclude from baseline generation deprecations triggered in legacy test [HttpFoundation] Update "[Session] Overwrite invalid session id" to only validate when files session storage is used [DoctrineBridge] Add missing break [PropertyInfo] CS fix [Serializer] Try all possible denormalization route with union types when ALLOW_EXTRA_ATTRIBUTES=false CS fix [Cache] Respect $save option in ChainAdapter [ExpressionLanguage] fix tests (bis) [ExpressionLanguage] fix tests Allow passing null in twig_is_selected_choice [Cache] Respect $save option in ArrayAdapter [HttpKernel] Disable session tracking while collecting profiler data [MonologBridge] Fixed support of elasticsearch 7.+ in ElasticsearchLogstashHandler [DoctrineBridge] Extend type guessing on enum fields [FrameworkBundle] Lower JsonSerializableNormalizer priority [Messenger] move resetting services at worker stopped into ResetServicesListener [Mailer] Fix Error Handling for OhMySMTP Bridge Fix for missing sender name in case with usage of the EnvelopeListener
2 parents a58dc88 + 47f2aa6 commit 86119d2

File tree

3 files changed

+22
-6
lines changed

3 files changed

+22
-6
lines changed

File/UploadedFile.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,11 +234,8 @@ private static function parseFilesize(string $size): int|float
234234

235235
switch (substr($size, -1)) {
236236
case 't': $max *= 1024;
237-
// no break
238237
case 'g': $max *= 1024;
239-
// no break
240238
case 'm': $max *= 1024;
241-
// no break
242239
case 'k': $max *= 1024;
243240
}
244241

Session/Storage/NativeSessionStorage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ public function start(): bool
136136
}
137137

138138
$sessionId = $_COOKIE[session_name()] ?? null;
139-
if ($sessionId && !preg_match('/^[a-zA-Z0-9,-]{22,}$/', $sessionId)) {
139+
if ($sessionId && $this->saveHandler instanceof AbstractProxy && 'files' === $this->saveHandler->getSaveHandlerName() && !preg_match('/^[a-zA-Z0-9,-]{22,}$/', $sessionId)) {
140140
// the session ID in the header is invalid, create a new one
141141
session_id(session_create_id());
142142
}

Tests/Session/Storage/NativeSessionStorageTest.php

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,12 +284,31 @@ public function testGetBagsOnceSessionStartedIsIgnored()
284284
$this->assertEquals($storage->getBag('flashes'), $bag);
285285
}
286286

287-
public function testRegenerateInvalidSessionId()
287+
public function testRegenerateInvalidSessionIdForNativeFileSessionHandler()
288288
{
289289
$_COOKIE[session_name()] = '&~[';
290-
$started = (new NativeSessionStorage())->start();
290+
session_id('&~[');
291+
$storage = new NativeSessionStorage([], new NativeFileSessionHandler());
292+
$started = $storage->start();
291293

292294
$this->assertTrue($started);
293295
$this->assertMatchesRegularExpression('/^[a-zA-Z0-9,-]{22,}$/', session_id());
296+
$storage->save();
297+
298+
$_COOKIE[session_name()] = '&~[';
299+
session_id('&~[');
300+
$storage = new NativeSessionStorage([], new SessionHandlerProxy(new NativeFileSessionHandler()));
301+
$started = $storage->start();
302+
303+
$this->assertTrue($started);
304+
$this->assertMatchesRegularExpression('/^[a-zA-Z0-9,-]{22,}$/', session_id());
305+
$storage->save();
306+
307+
$_COOKIE[session_name()] = '&~[';
308+
session_id('&~[');
309+
$storage = new NativeSessionStorage([], new NullSessionHandler());
310+
$started = $storage->start();
311+
$this->assertTrue($started);
312+
$this->assertSame('&~[', session_id());
294313
}
295314
}

0 commit comments

Comments
 (0)