Skip to content

Commit 525df54

Browse files
Merge branch '5.4' into 6.0
* 5.4: [Mailer] fix tests [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 b765226 + 78e4118 commit 525df54

File tree

6 files changed

+14
-9
lines changed

6 files changed

+14
-9
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@ private function shouldEnableEntityLoader(): bool
680680
});
681681
$schema = '<?xml version="1.0" encoding="utf-8"?>
682682
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
683-
<xsd:include schemaLocation="file:///'.str_replace('\\', '/', $tmpfile).'" />
683+
<xsd:include schemaLocation="file:///'.rawurlencode(str_replace('\\', '/', $tmpfile)).'" />
684684
</xsd:schema>';
685685
file_put_contents($tmpfile, '<?xml version="1.0" encoding="utf-8"?>
686686
<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
@@ -136,7 +136,7 @@ public function start(): bool
136136
}
137137

138138
$sessionId = $_COOKIE[session_name()] ?? null;
139-
if ($sessionId && $this->saveHandler instanceof AbstractProxy && 'files' === $this->saveHandler->getSaveHandlerName() && !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,250}$/', $sessionId)) {
140140
// the session ID in the header is invalid, create a new one
141141
session_id(session_create_id());
142142
}

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

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

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

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

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

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

src/Symfony/Component/Mailer/Transport/NativeTransportFactory.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function create(Dsn $dsn): TransportInterface
2929
throw new UnsupportedSchemeException($dsn, 'native', $this->getSupportedSchemes());
3030
}
3131

32-
if ($sendMailPath = \ini_get('sendmail_path')) {
32+
if ($sendMailPath = ini_get('sendmail_path')) {
3333
return new SendmailTransport($sendMailPath, $this->dispatcher, $this->logger);
3434
}
3535

@@ -39,8 +39,8 @@ public function create(Dsn $dsn): TransportInterface
3939

4040
// Only for windows hosts; at this point non-windows
4141
// host have already thrown an exception or returned a transport
42-
$host = \ini_get('SMTP');
43-
$port = (int) \ini_get('smtp_port');
42+
$host = ini_get('SMTP');
43+
$port = (int) ini_get('smtp_port');
4444

4545
if (!$host || !$port) {
4646
throw new TransportException('smtp or smtp_port is not configured in php.ini.');

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)