Skip to content

Commit ebcfb62

Browse files
committed
Merge branch '5.4' into 6.3
* 5.4: [Form] Fix merging form data and files (ter) [Intl] Update the ICU data to 74.1 [DoctrineBridge] Fix exception message [Security][Validator] Missing translations for Luxembourgish
2 parents 49abe89 + 9976f9c commit ebcfb62

File tree

665 files changed

+7942
-6019
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

665 files changed

+7942
-6019
lines changed

src/Symfony/Bridge/Doctrine/Form/ChoiceList/DoctrineChoiceLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function __construct(ObjectManager $manager, string $class, IdReader $idR
4141
$classMetadata = $manager->getClassMetadata($class);
4242

4343
if ($idReader && !$idReader->isSingleId()) {
44-
throw new \InvalidArgumentException(sprintf('The second argument "$idReader" of "%s" must be null when the query cannot be optimized because of composite id fields.', __METHOD__));
44+
throw new \InvalidArgumentException(sprintf('The "$idReader" argument of "%s" must be null when the query cannot be optimized because of composite id fields.', __METHOD__));
4545
}
4646

4747
$this->manager = $manager;

src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/DoctrineChoiceLoaderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ public function testLoadChoicesForValuesLoadsOnlyChoicesIfValueIsIdReader()
416416
public function testPassingIdReaderWithoutSingleIdEntity()
417417
{
418418
$this->expectException(\InvalidArgumentException::class);
419-
$this->expectExceptionMessage('The second argument "$idReader" of "Symfony\\Bridge\\Doctrine\\Form\\ChoiceList\\DoctrineChoiceLoader::__construct" must be null when the query cannot be optimized because of composite id fields.');
419+
$this->expectExceptionMessage('The "$idReader" argument of "Symfony\\Bridge\\Doctrine\\Form\\ChoiceList\\DoctrineChoiceLoader::__construct" must be null when the query cannot be optimized because of composite id fields.');
420420

421421
$idReader = $this->createMock(IdReader::class);
422422
$idReader->expects($this->once())

src/Symfony/Component/Form/Tests/AbstractRequestHandlerTestCase.php

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use PHPUnit\Framework\TestCase;
1515
use Symfony\Component\EventDispatcher\EventDispatcher;
1616
use Symfony\Component\Form\Extension\Core\DataMapper\DataMapper;
17+
use Symfony\Component\Form\Extension\Core\Type\CollectionType;
1718
use Symfony\Component\Form\Extension\Core\Type\TextType;
1819
use Symfony\Component\Form\Form;
1920
use Symfony\Component\Form\FormBuilder;
@@ -23,6 +24,7 @@
2324
use Symfony\Component\Form\Forms;
2425
use Symfony\Component\Form\RequestHandlerInterface;
2526
use Symfony\Component\Form\ResolvedFormTypeFactory;
27+
use Symfony\Component\Form\Tests\Extension\Type\ItemFileType;
2628
use Symfony\Component\Form\Util\ServerParams;
2729

2830
/**
@@ -311,6 +313,48 @@ public function testParamTakesPrecedenceOverFile($method)
311313
$this->assertSame('DATA', $form->getData());
312314
}
313315

316+
public function testMergeZeroIndexedCollection()
317+
{
318+
$form = $this->createForm('root', 'POST', true);
319+
$form->add('items', CollectionType::class, [
320+
'entry_type' => ItemFileType::class,
321+
'allow_add' => true,
322+
]);
323+
324+
$file = $this->getUploadedFile();
325+
326+
$this->setRequestData('POST', [
327+
'root' => [
328+
'items' => [
329+
0 => [
330+
'item' => 'test',
331+
],
332+
],
333+
],
334+
], [
335+
'root' => [
336+
'items' => [
337+
0 => [
338+
'file' => $file,
339+
],
340+
],
341+
],
342+
]);
343+
344+
$this->requestHandler->handleRequest($form, $this->request);
345+
346+
$itemsForm = $form->get('items');
347+
348+
$this->assertTrue($form->isSubmitted());
349+
$this->assertTrue($form->isValid());
350+
351+
$this->assertTrue($itemsForm->has('0'));
352+
$this->assertFalse($itemsForm->has('1'));
353+
354+
$this->assertEquals('test', $itemsForm->get('0')->get('item')->getData());
355+
$this->assertNotNull($itemsForm->get('0')->get('file'));
356+
}
357+
314358
/**
315359
* @dataProvider methodExceptGetProvider
316360
*/
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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\Form\Tests\Extension\Type;
13+
14+
use Symfony\Component\Form\AbstractType;
15+
use Symfony\Component\Form\Extension\Core\Type\FileType;
16+
use Symfony\Component\Form\Extension\Core\Type\TextType;
17+
use Symfony\Component\Form\FormBuilderInterface;
18+
19+
class ItemFileType extends AbstractType
20+
{
21+
public function buildForm(FormBuilderInterface $builder, array $options): void
22+
{
23+
$builder->add('item', TextType::class);
24+
$builder->add('file', FileType::class);
25+
}
26+
}

src/Symfony/Component/Form/Util/FormUtil.php

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,7 @@ public static function isEmpty(mixed $data): bool
4646
*/
4747
public static function mergeParamsAndFiles(array $params, array $files): array
4848
{
49-
if (array_is_list($files)) {
50-
foreach ($files as $value) {
51-
$params[] = $value;
52-
}
53-
54-
return $params;
55-
}
49+
$isFilesList = array_is_list($files);
5650

5751
foreach ($params as $key => $value) {
5852
if (\is_array($value) && \is_array($files[$key] ?? null)) {
@@ -61,6 +55,14 @@ public static function mergeParamsAndFiles(array $params, array $files): array
6155
}
6256
}
6357

64-
return array_replace($params, $files);
58+
if (!$isFilesList) {
59+
return array_replace($params, $files);
60+
}
61+
62+
foreach ($files as $value) {
63+
$params[] = $value;
64+
}
65+
66+
return $params;
6567
}
6668
}

src/Symfony/Component/Intl/Intl.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public static function getIcuDataVersion(): string
106106
*/
107107
public static function getIcuStubVersion(): string
108108
{
109-
return '73.2';
109+
return '74.1';
110110
}
111111

112112
/**
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
[[ $1 == force ]] && docker pull jakzal/php-intl
3+
[[ $1 == force ]] && docker pull jakzal/php-intl:8.2-73.2
44
[[ ! -d /tmp/symfony/icu ]] && mkdir -p /tmp/symfony/icu
55

66
docker run \
@@ -9,5 +9,5 @@ docker run \
99
-v /tmp/symfony/icu:/tmp \
1010
-v $(pwd):/symfony \
1111
-w /symfony \
12-
jakzal/php-intl:8.1-70.1 \
12+
jakzal/php-intl:8.2-73.2 \
1313
php src/Symfony/Component/Intl/Resources/bin/update-data.php

src/Symfony/Component/Intl/Resources/data/currencies/af.php

Lines changed: 5 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Symfony/Component/Intl/Resources/data/currencies/ak.php

Lines changed: 5 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Symfony/Component/Intl/Resources/data/currencies/am.php

Lines changed: 5 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)