Skip to content

Commit d8bc0eb

Browse files
committed
Merge branch '5.4' into 6.4
* 5.4: [HttpClient] Fix setting CURLMOPT_MAXCONNECTS throw a meaningful exception when parsing dotenv files with BOM [Cache] Fix RedisSentinel params types [FrameworkBundle] Fix service reset between tests [Uid][Serializer][Validator] Mention RFC 9562 make sure temp files can be cleaned up on Windows
2 parents c49d6db + 56fa4dc commit d8bc0eb

File tree

22 files changed

+145
-19
lines changed

22 files changed

+145
-19
lines changed

.github/workflows/integration-tests.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,19 @@ jobs:
122122
image: dunglas/frankenphp:1.1.0
123123
ports:
124124
- 80:80
125+
- 8681:81
126+
- 8682:82
127+
- 8683:83
128+
- 8684:84
125129
volumes:
126130
- ${{ github.workspace }}:/symfony
127131
env:
128-
SERVER_NAME: 'http://localhost'
132+
SERVER_NAME: 'http://localhost http://localhost:81 http://localhost:82 http://localhost:83 http://localhost:84'
129133
CADDY_SERVER_EXTRA_DIRECTIVES: |
130-
root * /symfony/src/Symfony/Component/HttpFoundation/Tests/Fixtures/response-functional/
134+
route /http-client* {
135+
root * /symfony/src/Symfony/Component/HttpClient/Tests/Fixtures/response-functional/
136+
php_server
137+
}
131138
132139
steps:
133140
- name: Checkout

src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,11 @@ protected static function ensureKernelShutdown()
129129
static::$kernel->shutdown();
130130
static::$booted = false;
131131

132+
if ($container->has('services_resetter')) {
133+
// Instantiate the service because Container::reset() only resets services that have been used
134+
$container->get('services_resetter');
135+
}
136+
132137
if ($container instanceof ResetInterface) {
133138
$container->reset();
134139
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle\TestServiceContainer;
13+
14+
class ResettableService
15+
{
16+
private $count = 0;
17+
18+
public function myCustomName(): void
19+
{
20+
++$this->count;
21+
}
22+
23+
public function getCount(): int
24+
{
25+
return $this->count;
26+
}
27+
}

src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/TestServiceContainer/services.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,8 @@ services:
2323
decorates: decorated
2424
properties:
2525
inner: '@.inner'
26+
27+
Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle\TestServiceContainer\ResettableService:
28+
public: true
29+
tags:
30+
- kernel.reset: { method: 'myCustomName' }

src/Symfony/Bundle/FrameworkBundle/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"ext-xml": "*",
2222
"symfony/cache": "^5.4|^6.0|^7.0",
2323
"symfony/config": "^6.1|^7.0",
24-
"symfony/dependency-injection": "^6.4|^7.0",
24+
"symfony/dependency-injection": "^6.4.12|^7.0",
2525
"symfony/deprecation-contracts": "^2.5|^3",
2626
"symfony/error-handler": "^6.1|^7.0",
2727
"symfony/event-dispatcher": "^5.4|^6.0|^7.0",

src/Symfony/Component/Cache/Tests/Adapter/RedisAdapterSentinelTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public static function setUpBeforeClass(): void
3232
self::markTestSkipped('REDIS_SENTINEL_SERVICE env var is not defined.');
3333
}
3434

35-
self::$redis = AbstractAdapter::createConnection('redis:?host['.str_replace(' ', ']&host[', $hosts).']', ['redis_sentinel' => $service, 'prefix' => 'prefix_']);
35+
self::$redis = AbstractAdapter::createConnection('redis:?host['.str_replace(' ', ']&host[', $hosts).']&timeout=0&retry_interval=0&read_timeout=0', ['redis_sentinel' => $service, 'prefix' => 'prefix_']);
3636
}
3737

3838
public function testInvalidDSNHasBothClusterAndSentinel()

src/Symfony/Component/Cache/Traits/RedisTrait.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,10 +232,10 @@ public static function createConnection(#[\SensitiveParameter] string $dsn, arra
232232
$options = [
233233
'host' => $host,
234234
'port' => $port,
235-
'connectTimeout' => $params['timeout'],
235+
'connectTimeout' => (float) $params['timeout'],
236236
'persistent' => $params['persistent_id'],
237-
'retryInterval' => $params['retry_interval'],
238-
'readTimeout' => $params['read_timeout'],
237+
'retryInterval' => (int) $params['retry_interval'],
238+
'readTimeout' => (float) $params['read_timeout'],
239239
];
240240

241241
if ($passAuth) {

src/Symfony/Component/DependencyInjection/Container.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,6 @@ public function initialized(string $id): bool
288288
public function reset()
289289
{
290290
$services = $this->services + $this->privates;
291-
$this->services = $this->factories = $this->privates = [];
292291

293292
foreach ($services as $service) {
294293
try {
@@ -299,6 +298,8 @@ public function reset()
299298
continue;
300299
}
301300
}
301+
302+
$this->services = $this->factories = $this->privates = [];
302303
}
303304

304305
/**

src/Symfony/Component/Dotenv/Dotenv.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,13 @@ private function doLoad(bool $overrideExistingVars, array $paths): void
553553
throw new PathException($path);
554554
}
555555

556-
$this->populate($this->parse(file_get_contents($path), $path), $overrideExistingVars);
556+
$data = file_get_contents($path);
557+
558+
if ("\xEF\xBB\xBF" === substr($data, 0, 3)) {
559+
throw new FormatException('Loading files starting with a byte-order-mark (BOM) is not supported.', new FormatExceptionContext($data, $path, 1, 0));
560+
}
561+
562+
$this->populate($this->parse($data, $path), $overrideExistingVars);
557563
}
558564
}
559565
}

src/Symfony/Component/Dotenv/Tests/DotenvTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -604,4 +604,14 @@ public function testBootEnv()
604604
$resetContext();
605605
rmdir($tmpdir);
606606
}
607+
608+
public function testExceptionWithBom()
609+
{
610+
$dotenv = new Dotenv();
611+
612+
$this->expectException(FormatException::class);
613+
$this->expectExceptionMessage('Loading files starting with a byte-order-mark (BOM) is not supported.');
614+
615+
$dotenv->load(__DIR__.'/fixtures/file_with_bom');
616+
}
607617
}

0 commit comments

Comments
 (0)