Skip to content

Commit 53d1f21

Browse files
Merge branch '4.4' into 5.4
* 4.4: [HttpFoundation] Prevent PHP Warning: Session ID is too long or contains illegal characters [Messenger] fix test [Messenger] Ceil waiting time when multiplier is a float on retry Spaces in system temp folder path cause deprecation errors in php 8
2 parents b893a71 + bf46a8d commit 53d1f21

File tree

5 files changed

+11
-6
lines changed

5 files changed

+11
-6
lines changed

src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,7 @@ private function shouldEnableEntityLoader(): bool
687687
});
688688
$schema = '<?xml version="1.0" encoding="utf-8"?>
689689
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
690-
<xsd:include schemaLocation="file:///'.str_replace('\\', '/', $tmpfile).'" />
690+
<xsd:include schemaLocation="file:///'.rawurlencode(str_replace('\\', '/', $tmpfile)).'" />
691691
</xsd:schema>';
692692
file_put_contents($tmpfile, '<?xml version="1.0" encoding="utf-8"?>
693693
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">

src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ public function start()
146146
}
147147

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

src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ public function testRegenerateInvalidSessionIdForNativeFileSessionHandler()
295295
$started = $storage->start();
296296

297297
$this->assertTrue($started);
298-
$this->assertMatchesRegularExpression('/^[a-zA-Z0-9,-]{22,}$/', session_id());
298+
$this->assertMatchesRegularExpression('/^[a-zA-Z0-9,-]{22,250}$/', session_id());
299299
$storage->save();
300300

301301
$_COOKIE[session_name()] = '&~[';
@@ -304,7 +304,7 @@ public function testRegenerateInvalidSessionIdForNativeFileSessionHandler()
304304
$started = $storage->start();
305305

306306
$this->assertTrue($started);
307-
$this->assertMatchesRegularExpression('/^[a-zA-Z0-9,-]{22,}$/', session_id());
307+
$this->assertMatchesRegularExpression('/^[a-zA-Z0-9,-]{22,250}$/', session_id());
308308
$storage->save();
309309

310310
$_COOKIE[session_name()] = '&~[';

src/Symfony/Component/Messenger/Retry/MultiplierRetryStrategy.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,6 @@ public function getWaitingTime(Envelope $message, \Throwable $throwable = null):
8686
return $this->maxDelayMilliseconds;
8787
}
8888

89-
return $delay;
89+
return (int) ceil($delay);
9090
}
9191
}

src/Symfony/Component/Messenger/Tests/Retry/MultiplierRetryStrategyTest.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function testIsRetryableWithNoStamp()
5252
/**
5353
* @dataProvider getWaitTimeTests
5454
*/
55-
public function testGetWaitTime(int $delay, int $multiplier, int $maxDelay, int $previousRetries, int $expectedDelay)
55+
public function testGetWaitTime(int $delay, float $multiplier, int $maxDelay, int $previousRetries, int $expectedDelay)
5656
{
5757
$strategy = new MultiplierRetryStrategy(10, $delay, $multiplier, $maxDelay);
5858
$envelope = new Envelope(new \stdClass(), [new RedeliveryStamp($previousRetries)]);
@@ -83,5 +83,10 @@ public function getWaitTimeTests(): iterable
8383
// never a delay
8484
yield [0, 2, 10000, 0, 0];
8585
yield [0, 2, 10000, 1, 0];
86+
87+
// Float delay
88+
yield [1000, 1.5555, 5000, 0, 1000];
89+
yield [1000, 1.5555, 5000, 1, 1556];
90+
yield [1000, 1.5555, 5000, 2, 2420];
8691
}
8792
}

0 commit comments

Comments
 (0)