8000 Merge branch '5.4' into 6.3 · symfony/symfony@e84257a · GitHub
[go: up one dir, main page]

Skip to content

Commit e84257a

Browse files
Merge branch '5.4' into 6.3
* 5.4: fix compatibility with Doctrine DBAL 4 ensure string type with mbstring func overloading enabled [Validator] updated Greek translation [Cache][HttpFoundation][Lock] Fix empty username/password for PDO PostgreSQL
2 parents df793d8 + a454d0c commit e84257a

File tree

8 files changed

+66
-19
lines changed

8 files changed

+66
-19
lines changed

src/Symfony/Component/Cache/Adapter/PdoAdapter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ class PdoAdapter extends AbstractAdapter implements PruneableInterface
3131
private mixed $dataCol = 'item_data';
3232
private mixed $lifetimeCol = 'item_lifetime';
3333
private mixed $timeCol = 'item_time';
34-
private mixed $username = '';
35-
private mixed $password = '';
34+
private mixed $username = null;
35+
private mixed $password = null;
3636
private mixed $connectionOptions = [];
3737
private string $namespace;
3838

src/Symfony/Component/HttpFoundation/HeaderUtils.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ public static function parseQuery(string $query, bool $ignoreBrackets = false, s
256256
private static function groupParts(array $matches, string $separators, bool $first = true): array
257257
{
258258
$separator = $separators[0];
259-
$separators = substr($separators, 1);
259+
$separators = substr($separators, 1) ?: '';
260260
$i = 0;
261261

262262
if ('' === $separators && !$first) {

src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,12 @@ class PdoSessionHandler extends AbstractSessionHandler
9090
/**
9191
* Username when lazy-connect.
9292
*/
93-
private string $username = '';
93+
private ?string $username = null;
9494

9595
/**
9696
* Password when lazy-connect.
9797
*/
98-
private string $password = '';
98+
private ?string $password = null;
9999

100100
/**
101101
* Connection options when lazy-connect.

src/Symfony/Component/Lock/Store/PdoStore.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ class PdoStore implements PersistingStoreInterface
3838
private \PDO $conn;
3939
private string $dsn;
4040
private string $driver;
41-
private string $username = '';
42-
private string $password = '';
41+
private ?string $username = null;
42+
private ?string $password = null;
4343
private array $connectionOptions = [];
4444

4545
/**

src/Symfony/Component/Lock/Store/PostgreSqlStore.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ class PostgreSqlStore implements BlockingSharedLockStoreInterface, BlockingStore
2828
{
2929
private \PDO $conn;
3030
private string $dsn;
31-
private string $username = '';
32-
private string $password = '';
31+
private ?string $username = null;
32+
private ?string $password = null;
3333
private array $connectionOptions = [];
3434
private static array $storeRegistry = [];
3535

src/Symfony/Component/Messenger/Bridge/Doctrine/Tests/Transport/ConnectionTest.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ public function testGetWithNoPendingMessageWillReturnNull()
8282
$queryBuilder
8383
->method('getParameterTypes')
8484
->willReturn([]);
85+
$queryBuilder
86+
->method('getSQL')
87+
->willReturn('SELECT FOR UPDATE');
8588
$driverConnection->expects($this->once())
8689
->method('createQueryBuilder')
8790
->willReturn($queryBuilder);
@@ -120,7 +123,11 @@ private function getDBALConnectionMock()
120123
{
121124
$driverConnection = $this->createMock(DBALConnection::class);
122125
$platform = $this->createMock(AbstractPlatform::class);
123-
$platform->method('getWriteLockSQL')->willReturn('FOR UPDATE');
126+
127+
if (!method_exists(QueryBuilder::class, 'forUpdate')) {
128+
$platform->method('getWriteLockSQL')->willReturn('FOR UPDATE');
129+
}
130+
124131
$configuration = $this->createMock(\Doctrine\DBAL\Configuration::class);
125132
$driverConnection->method('getDatabasePlatform')->willReturn($platform);
126133
$driverConnection->method('getConfiguration')->willReturn($configuration);
@@ -375,7 +382,9 @@ public function testGeneratedSql(AbstractPlatform $platform, string $expectedSql
375382
$driverConnection
376383
->expects($this->once())
377384
->method('executeQuery')
378-
->with($expectedSql)
385+
->with($this->callback(function ($sql) use ($expectedSql) {
386+
return trim($expectedSql) === trim($sql);
387+
}))
379388
->willReturn($result)
380389
;
381390
$driverConnection->expects($this->once())->method('commit');

src/Symfony/Component/Messenger/Bridge/Doctrine/Transport/Connection.php

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,24 @@ public function get(): ?array
178178

179179
// Append pessimistic write lock to FROM clause if db platform supports it
180180
$sql = $query->getSQL();
181-
if (preg_match('/FROM (.+) WHERE/', (string) $sql, $matches)) {
181+
182+
// Wrap the rownum query in a sub-query to allow writelocks without ORA-02014 error
183+
if ($this->driverConnection->getDatabasePlatform() instanceof OraclePlatform) {
184+
$query = $this->createQueryBuilder('w')
185+
->where('w.id IN ('.str_replace('SELECT a.* FROM', 'SELECT a.id FROM', $sql).')');
186+
187+
if (method_exists(QueryBuilder::class, 'forUpdate')) {
188+
$query->forUpdate();
189+
}
190+
191+
$sql = $query->getSQL();
192+
} elseif (method_exists(QueryBuilder::class, 'forUpdate')) {
193+
$query->forUpdate();
194+
try {
195+
$sql = $query->getSQL();
196+
} catch (DBALException $e) {
197+
}
198+
} elseif (preg_match('/FROM (.+) WHERE/', (string) $sql, $matches)) {
182199
$fromClause = $matches[1];
183200
$sql = str_replace(
184201
sprintf('FROM %s WHERE', $fromClause),
@@ -187,16 +204,13 @@ public function get(): ?array
187204
);
188205
}
189206

190-
// Wrap the rownum query in a sub-query to allow writelocks without ORA-02014 error
191-
if ($this->driverConnection->getDatabasePlatform() instanceof OraclePlatform) {
192-
$sql = $this->createQueryBuilder('w')
193-
->where('w.id IN ('.str_replace('SELECT a.* FROM', 'SELECT a.id FROM', $sql).')')
194-
->getSQL();
207+
// use SELECT ... FOR UPDATE to lock table
208+
if (!method_exists(QueryBuilder::class, 'forUpdate')) {
209+
$sql .= ' '.$this->driverConnection->getDatabasePlatform()->getWriteLockSQL();
195210
}
196211

197-
// use SELECT ... FOR UPDATE to lock table
198212
$stmt = $this->executeQuery(
199-
$sql.' '.$this->driverConnection->getDatabasePlatform()->getWriteLockSQL(),
213+
$sql,
200214
$query->getParameters(),
201215
$query->getParameterTypes()
202216
);

src/Symfony/Component/Validator/Resources/translations/validators.el.xlf

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,30 @@
402402
<source>The value of the netmask should be between {{ min }} and {{ max }}.</source>
403403
<target>Η τιμή του netmask πρέπει να είναι ανάμεσα σε {{ min }} και {{ max }}.</target>
404404
</trans-unit>
405+
<trans-unit id="104">
406+
<source>The filename is too long. It should have {{ filename_max_length }} character or less.|The filename is too long. It should have {{ filename_max_length }} characters or less.</source>
407+
<target>Το όνομα αρχείου είναι πολύ μεγάλο. Θα πρέπει να έχει έως {{ filename_max_length }} χαρακτήρα.|Το όνομα αρχείου είναι πολύ μεγάλο. Θα πρέπει να έχει έως {{ filename_max_length }} χαρακτήρες.</target>
408+
</trans-unit>
409+
<trans-unit id="105">
410+
<source>The password strength is too low. Please use a stronger password.</source>
411+
<target>Η ισχύς του κωδικού πρόσβασης είναι πολύ χαμηλή. Χρησιμοποιήστε έναν ισχυρότερο κωδικό πρόσβασης.</target>
412+
</trans-unit>
413+
<trans-unit id="106">
414+
<source>This value contains characters that are not allowed by the current restriction-level.</source>
415+
<target>Αυτή η τιμή περιέχει χαρακτήρες που δεν επιτρέπονται από το τρέχον επίπεδο περιορισμού.</target>
416+
</trans-unit>
417+
<trans-unit id="107">
418+
<source>Using invisible characters is not allowed.</source>
419+
<target>Δεν επιτρέπεται η χρήση αόρατων χαρακτήρων.</target>
420+
</trans-unit>
421+
<trans-unit id="108">
422+
<source>Mixing numbers from different scripts is not allowed.</source>
423+
<target>Δεν επιτρέπεται η μίξη αριθμών από διαφορετικά γραφήματα.</target>
424+
</trans-unit>
425+
<trans-unit id="109">
426+
<source>Using hidden overlay characters is not allowed.</source>
427+
<target>Δεν επιτρέπεται η χρήση κρυφών χαρακτήρων επικάλυψης.</target>
428+
</trans-unit>
405429
</body>
406430
</file>
407431
</xliff>

0 commit comments

Comments
 (0)
0