Skip to content

Commit 69d8812

Browse files
committed
Merge branch '7.1' into 7.2
* 7.1: [Notifier] [Lox24] Fix request body format to JSON string inject the missing logger service fix handling of special "value" constraint option send the recipient phone number as an array [DependencyInjection] Fix ternary in AutowireCallable attribute [Security] Change to `BadCredentialsException` when empty username / password Add a note about the change in the default cache namespace generation to the upgrade guide fix test Fix CS [Messenger] Added postgres asset filter integration test change notifier type for brevo from chatter to texter avoid calling undefined built-in is_*() functions [AssetMapper] fix npm version constraint conversion Bump Symfony version to 7.1.2 Update VERSION for 7.1.1 Update CHANGELOG for 7.1.1
2 parents c0e30bb + ab8f354 commit 69d8812

File tree

18 files changed

+277
-64
lines changed

18 files changed

+277
-64
lines changed

CHANGELOG-7.1.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,21 @@ in 7.1 minor versions.
77
To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash
88
To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v7.1.0...v7.1.1
99

10+
* 7.1.1 (2024-06-04)
11+
12+
* bug #57110 [PhpUnitBridge] Fix error handler triggered outside of tests (HypeMC)
13+
* bug #57305 [Validator] do not modify a constraint during validation to not leak its context (xabbuh)
14+
* bug #57297 [FrameworkBundle] not registered definitions must not be modified (xabbuh)
15+
* bug #57234 [String] Fix Inflector for 'hardware' (podhy)
16+
* bug #57224 [Mime] Use streams instead of loading raw message generator into memory (bytestream)
17+
* bug #57284 [Mime] Fix TextPart using an unknown File (fabpot)
18+
* bug #57282 [Scheduler] Throw an exception when no dispatcher has been passed to a Schedule (fabpot)
19+
* bug #57276 Fix autoload configs to avoid warnings when building optimized autoloaders (Seldaek)
20+
* bug #57275 Fix autoload configs to avoid warnings when building optimized autoloaders (Seldaek)
21+
* bug #57263 [SecurityBundle] Fix `container.build_hash` parameter binding (alexandre-daubois)
22+
* bug #57197 [Serializer] Fix denormalizing a collection of union types (HypeMC)
23+
* bug #57188 [DoctrineBridge] Fix `UniqueEntityValidator` with proxy object (HypeMC)
24+
1025
* 7.1.0 (2024-05-31)
1126

1227
* bug #57248 [DoctrineBridge] Revert deprecating by-{id} mapping of entities (nicolas-grekas)

UPGRADE-7.1.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ Cache
4545
-----
4646

4747
* Deprecate `CouchbaseBucketAdapter`, use `CouchbaseCollectionAdapter` with Couchbase 3 instead
48+
* The algorithm for the default cache namespace changed from SHA256 to XXH128
4849

4950
DependencyInjection
5051
-------------------

src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@ public function testAttributeWithGroupsAndPaylod()
6060
self::assertSame('some attached data', $constraint->payload);
6161
self::assertSame(['some_group'], $constraint->groups);
6262
}
63+
64+
public function testValueOptionConfiguresFields()
65+
{
66+
$constraint = new UniqueEntity(['value' => 'email']);
67+
68+
$this->assertSame('email', $constraint->fields);
69+
}
6370
}
6471

6572
#[UniqueEntity(['email'], message: 'myMessage')]

src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntity.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function __construct(
6060
$payload = null,
6161
array $options = [],
6262
) {
63-
if (\is_array($fields) && \is_string(key($fields)) && [] === array_diff(array_keys($fields), array_keys(get_class_vars(static::class)))) {
63+
if (\is_array($fields) && \is_string(key($fields)) && [] === array_diff(array_keys($fields), array_merge(array_keys(get_class_vars(static::class)), ['value']))) {
6464
$options = array_merge($fields, $options);
6565
} else {
6666
$options['fields'] = $fields;

src/Symfony/Bundle/FrameworkBundle/Resources/config/notifier_transports.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727

2828
$chatterFactories = [
2929
'bluesky' => Bridge\Bluesky\BlueskyTransportFactory::class,
30-
'brevo' => Bridge\Brevo\BrevoTransportFactory::class,
3130
'chatwork' => Bridge\Chatwork\ChatworkTransportFactory::class,
3231
'discord' => Bridge\Discord\DiscordTransportFactory::class,
3332
'fake-chat' => Bridge\FakeChat\FakeChatTransportFactory::class,
@@ -59,6 +58,7 @@
5958
$texterFactories = [
6059
'all-my-sms' => Bridge\AllMySms\AllMySmsTransportFactory::class,
6160
'bandwidth' => Bridge\Bandwidth\BandwidthTransportFactory::class,
61+
'brevo' => Bridge\Brevo\BrevoTransportFactory::class,
6262
'click-send' => Bridge\ClickSend\ClickSendTransportFactory::class,
6363
'clickatell' => Bridge\Clickatell\ClickatellTransportFactory::class,
6464
'contact-everyone' => Bridge\ContactEveryone\ContactEveryoneTransportFactory::class,

src/Symfony/Component/AssetMapper/ImportMap/ImportMapVersionChecker.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public static function convertNpmConstraint(string $versionConstraint): ?string
137137
if (str_contains($segment, '-') && !preg_match('/-(alpha|beta|rc)\./', $segment)) {
138138
// This is a range
139139
[$start, $end] = explode('-', $segment);
140-
$processedSegments[] = '>='.self::cleanVersionSegment(trim($start)).' <='.self::cleanVersionSegment(trim($end));
140+
$processedSegments[] = self::cleanVersionSegment(trim($start)).' - '.self::cleanVersionSegment(trim($end));
141141
} elseif (preg_match('/^~(\d+\.\d+)$/', $segment, $matches)) {
142142
// Handle the tilde when only major.minor specified
143143
$baseVersion = $matches[1];

src/Symfony/Component/AssetMapper/Tests/ImportMap/ImportMapVersionCheckerTest.php

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,26 @@ public static function getCheckVersionsTests()
261261
new PackageVersionProblem('foo', 'bar', 'some/repo', '1.5.0'),
262262
],
263263
];
264+
265+
yield 'single with range constraint but no problem' => [
266+
[
267+
self::createRemoteEntry('foo', version: '1.0'),
268+
self::createRemoteEntry('bar', version: '2.0.3'),
269+
],
270+
[
271+
'foo' => ['bar'],
272+
'bar' => [],
273+
],
274+
[
275+
[
276+
'url' => '/foo/1.0',
277+
'response' => [
278+
'dependencies' => ['bar' => '1.11 - 2'],
279+
],
280+
],
281+
],
282+
[],
283+
];
264284
}
265285

266286
/**
@@ -297,22 +317,22 @@ public static function getNpmSpecificVersionConstraints()
297317
// Hyphen Ranges
298318
yield 'hyphen range simple' => [
299319
'1.0.0 - 2.0.0',
300-
'>=1.0.0 <=2.0.0',
320+
'1.0.0 - 2.0.0',
301321
];
302322

303323
yield 'hyphen range with v prefix' => [
304324
'v1.0.0 - 2.0.0',
305-
'>=1.0.0 <=2.0.0',
325+
'1.0.0 - 2.0.0',
306326
];
307327

308328
yield 'hyphen range without patch' => [
309329
'1.0 - 2.0',
310-
'>=1.0 <=2.0',
330+
'1.0 - 2.0',
311331
];
312332

313333
yield 'hyphen range with no spaces' => [
314334
'1.0-v2.0',
315-
'>=1.0 <=2.0',
335+
'1.0 - 2.0',
316336
];
317337

318338
// .x Wildcards
@@ -386,7 +406,7 @@ public static function getNpmSpecificVersionConstraints()
386406

387407
yield 'multiple constraints with space and or operator' => [
388408
'1.2.7 || 1.2.9- v2.0.0',
389-
'1.2.7 || >=1.2.9 <=2.0.0',
409+
'1.2.7 || 1.2.9 - 2.0.0',
390410
];
391411

392412
yield 'tilde constraint with patch version no change' => [

src/Symfony/Component/Cache/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ CHANGELOG
88
* Deprecate `CouchbaseBucketAdapter`, use `CouchbaseCollectionAdapter`
99
* Add support for URL encoded characters in Couchbase DSN
1010
* Add support for using DSN with PDOAdapter
11+
* The algorithm for the default cache namespace changed from SHA256 to XXH128
1112

1213
7.0
1314
---

src/Symfony/Component/DependencyInjection/Attribute/AutowireCallable.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function __construct(
4545

4646
public function buildDefinition(mixed $value, ?string $type, \ReflectionParameter $parameter): Definition
4747
{
48-
return (new Definition($type = \is_string($this->lazy) ? $this->lazy : ($type ?: 'Closure')))
48+
return (new Definition($type = \is_array($this->lazy) ? current($this->lazy) : ($type ?: 'Closure')))
4949
->setFactory(['Closure', 'fromCallable'])
5050
->setArguments([\is_array($value) ? $value + [1 => '__invoke'] : $value])
5151
->setLazy($this->lazy || 'Closure' !== $type && 'callable' !== (string) $parameter->getType());
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
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\Component\Messenger\Bridge\Doctrine\Tests\Transport;
13+
14+
use Doctrine\DBAL\Configuration;
15+
use Doctrine\DBAL\Connection;
16+
use Doctrine\DBAL\DriverManager;
17+
use Doctrine\DBAL\Schema\Column;
18+
use Doctrine\DBAL\Schema\DefaultSchemaManagerFactory;
19+
use Doctrine\DBAL\Schema\Sequence;
20+
use Doctrine\DBAL\Schema\Table;
21+
use Doctrine\DBAL\Tools\DsnParser;
22+
use Doctrine\DBAL\Types\Type;
23+
use PHPUnit\Framework\TestCase;
24+
use Symfony\Component\Messenger\Bridge\Doctrine\Transport\PostgreSqlConnection;
25+
26+
/**
27+
* This test checks on a postgres connection whether the doctrine asset filter works as expected.
28+
*
29+
* @requires extension pdo_pgsql
30+
*
31+
* @group integration
32+
*/
33+
class DoctrinePostgreSqlFilterIntegrationTest extends TestCase
34+
{
35+
private Connection $driverConnection;
36+
37+
protected function setUp(): void
38+
{
39+
if (!$host = getenv('POSTGRES_HOST')) {
40+
$this->markTestSkipped('Missing POSTGRES_HOST env variable');
41+
}
42+
43+
$url = "pdo-pgsql://postgres:password@$host";
44+
$params = (new DsnParser())->parse($url);
45+
$config = new Configuration();
46+
if (class_exists(DefaultSchemaManagerFactory::class)) {
47+
$config->setSchemaManagerFactory(new DefaultSchemaManagerFactory());
48+
}
49+
50+
$this->driverConnection = DriverManager::getConnection($params, $config);
51+
52+
$this->createAssets();
53+
}
54+
55+
protected function tearDown(): void
56+
{
57+
$this->removeAssets();
58+
59+
$this->driverConnection->close();
60+
}
61+
62+
public function testFilterAssets()
63+
{
64+
$schemaManager = $this->driverConnection->createSchemaManager();
65+
66+
$this->assertFalse($schemaManager->tablesExist(['queue_table']));
67+
$this->assertTrue($schemaManager->tablesExist(['app_table']));
68+
$this->assertTrue($this->hasSequence('app_table_id'));
69+
70+
$connection = new PostgreSqlConnection(['table_name' => 'queue_table'], $this->driverConnection);
71+
$connection->setup();
72+
73+
$schemaManager = $this->driverConnection->createSchemaManager();
74+
75+
$this->assertTrue($schemaManager->tablesExist(['queue_table']));
76+
$this->assertTrue($schemaManager->tablesExist(['app_table']));
77+
$this->assertTrue($this->hasSequence('app_table_id'));
78+
}
79+
80+
private function createAssets(): void
81+
{
82+
$this->removeAssets();
83+
84+
$schemaManager = $this->driverConnection->createSchemaManager();
85+
$schemaManager->createTable(new Table('app_table', [new Column('id', Type::getType('integer'))]));
86+
$schemaManager->createSequence(new Sequence('app_table_id'));
87+
}
88+
89+
private function removeAssets(): void
90+
{
91+
$schemaManager = $this->driverConnection->createSchemaManager();
92+
93+
if ($schemaManager->tablesExist(['queue_table'])) {
94+
$schemaManager->dropTable('queue_table');
95+
}
96+
97+
if ($schemaManager->tablesExist(['app_table'])) {
98+
$schemaManager->dropTable('app_table');
99+
}
100+
101+
if ($this->hasSequence('app_table_id')) {
102+
$schemaManager->dropSequence('app_table_id');
103+
}
104+
}
105+
106+
private function hasSequence(string $name): bool
107+
{
108+
$schemaManager = $this->driverConnection->createSchemaManager();
109+
110+
$sequences = $schemaManager->listSequences();
111+
foreach ($sequences as $sequence) {
112+
if ($sequence->getName() === $name) {
113+
return true;
114+
}
115+
}
116+
117+
return false;
118+
}
119+
}

0 commit comments

Comments
 (0)