Skip to content

Commit b6c7abc

Browse files
committed
Merge branch '7.2' into 7.3
* 7.2: chore: fix CS [Console] Fix division by 0 error [ErrorHandler] Fix error message with PHP 8.5 Update SendgridSmtpTransport.php add test covering associated entities referenced by their primary key Add an experimental CI job for PHP 8.5 Fix change log to mentioned thrown exception [FrameworkBundle] Make uri_signer lazy and improve error when kernel.secret is empty [HttpClient] Always set CURLOPT_CUSTOMREQUEST to the correct HTTP method in CurlHttpClient evaluate access flags for properties with asymmetric visibility [Mime] Fix wrong PHPDoc in `FormDataPart` constructor
2 parents 0d28cf1 + 25c15db commit b6c7abc

File tree

27 files changed

+167
-21
lines changed

27 files changed

+167
-21
lines changed

.github/workflows/unit-tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ jobs:
3636
# brotli and zstd extensions are optional, when not present the commands will be used instead,
3737
# we must test both scenarios
3838
extensions: amqp,apcu,brotli,igbinary,intl,mbstring,memcached,redis,relay,zstd
39+
- php: '8.5'
3940
#mode: experimental
4041
fail-fast: false
4142

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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\Bridge\Doctrine\Tests\Fixtures;
13+
14+
class AssociatedEntityDto
15+
{
16+
public $singleId;
17+
}

src/Symfony/Bridge/Doctrine/Tests/Security/RememberMe/DoctrineTokenProviderPostgresTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
/**
1212
* @requires extension pdo_pgsql
13+
*
1314
* @group integration
1415
*/
1516
class DoctrineTokenProviderPostgresTest extends DoctrineTokenProviderTest

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

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
use Doctrine\Persistence\ObjectManager;
2222
use PHPUnit\Framework\MockObject\MockObject;
2323
use Symfony\Bridge\Doctrine\Tests\DoctrineTestHelper;
24+
use Symfony\Bridge\Doctrine\Tests\Fixtures\AssociatedEntityDto;
2425
use Symfony\Bridge\Doctrine\Tests\Fixtures\AssociationEntity;
2526
use Symfony\Bridge\Doctrine\Tests\Fixtures\AssociationEntity2;
2627
use Symfony\Bridge\Doctrine\Tests\Fixtures\CompositeIntIdEntity;
@@ -609,6 +610,40 @@ public function testAssociatedEntityWithNull()
609610
$this->assertNoViolation();
610611
}
611612

613+
public function testAssociatedEntityReferencedByPrimaryKey()
614+
{
615+
$this->registry = $this->createRegistryMock($this->em);
616+
$this->registry->expects($this->any())
617+
->method('getManagerForClass')
618+
->willReturn($this->em);
619+
$this->validator = $this->createValidator();
620+
$this->validator->initialize($this->context);
621+
622+
$entity = new SingleIntIdEntity(1, 'foo');
623+
$associated = new AssociationEntity();
624+
$associated->single = $entity;
625+
626+
$this->em->persist($entity);
627+
$this->em->persist($associated);
628+
$this->em->flush();
629+
630+
$dto = new AssociatedEntityDto();
631+
$dto->singleId = 1;
632+
633+
$this->validator->validate($dto, new UniqueEntity(
634+
fields: ['singleId' => 'single'],
635+
entityClass: AssociationEntity::class,
636+
));
637+
638+
$this->buildViolation('This value is already used.')
639+
->atPath('property.path.single')
640+
->setParameter('{{ value }}', 1)
641+
->setInvalidValue(1)
642+
->setCode(UniqueEntity::NOT_UNIQUE_ERROR)
643+
->setCause([$associated])
644+
->assertRaised();
645+
}
646+
612647
public function testValidateUniquenessWithArrayValue()
613648
{
614649
$repository = $this->createRepositoryMock(SingleIntIdEntity::class);

src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
8686
['Timezone', date_default_timezone_get().' (<comment>'.(new \DateTimeImmutable())->format(\DateTimeInterface::W3C).'</>)'],
8787
['OPcache', \extension_loaded('Zend OPcache') ? (filter_var(\ini_get('opcache.enable'), FILTER_VALIDATE_BOOLEAN) ? 'Enabled' : 'Not enabled') : 'Not installed'],
8888
['APCu', \extension_loaded('apcu') ? (filter_var(\ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? 'Enabled' : 'Not enabled') : 'Not installed'],
89-
['Xdebug', \extension_loaded('xdebug') ? ($xdebugMode && $xdebugMode !== 'off' ? 'Enabled (' . $xdebugMode . ')' : 'Not enabled') : 'Not installed'],
89+
['Xdebug', \extension_loaded('xdebug') ? ($xdebugMode && 'off' !== $xdebugMode ? 'Enabled (' . $xdebugMode . ')' : 'Not enabled') : 'Not installed'],
9090
];
9191

9292
$io->table([], $rows);

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,10 +311,17 @@ public function load(array $configs, ContainerBuilder $container): void
311311
}
312312
}
313313

314+
$emptySecretHint = '"framework.secret" option';
314315
if (isset($config['secret'])) {
315316
$container->setParameter('kernel.secret', $config['secret']);
317+
$usedEnvs = [];
318+
$container->resolveEnvPlaceholders($config['secret'], null, $usedEnvs);
319+
320+
if ($usedEnvs) {
321+
$emptySecretHint = \sprintf('"%s" env var%s', implode('", "', $usedEnvs), 1 === \count($usedEnvs) ? '' : 's');
322+
}
316323
}
317-
$container->parameterCannotBeEmpty('kernel.secret', 'A non-empty value for the parameter "kernel.secret" is required. Did you forget to configure the "framework.secret" option?');
324+
$container->parameterCannotBeEmpty('kernel.secret', 'A non-empty value for the parameter "kernel.secret" is required. Did you forget to configure the '.$emptySecretHint.'?');
318325

319326
$container->setParameter('kernel.http_method_override', $config['http_method_override']);
320327
$container->setParameter('kernel.trust_x_sendfile_type_header', $config['trust_x_sendfile_type_header']);

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ class_exists(WorkflowEvents::class) ? WorkflowEvents::ALIASES : []
157157
->args([
158158
new Parameter('kernel.secret'),
159159
])
160+
->lazy()
160161
->alias(UriSigner::class, 'uri_signer')
161162

162163
->set('config_cache_factory', ResourceCheckerConfigCacheFactory::class)

src/Symfony/Component/Cache/Traits/Relay/MoveTrait.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ public function lmove($srckey, $dstkey, $srcpos, $dstpos): mixed
3333
*/
3434
trait MoveTrait
3535
{
36-
public function blmove($srckey, $dstkey, $srcpos, $dstpos, $timeout): \Relay\Relay|false|null|string
36+
public function blmove($srckey, $dstkey, $srcpos, $dstpos, $timeout): \Relay\Relay|false|string|null
3737
{
3838
return $this->initializeLazyObject()->blmove(...\func_get_args());
3939
}
4040

41-
public function lmove($srckey, $dstkey, $srcpos, $dstpos): \Relay\Relay|false|null|string
41+
public function lmove($srckey, $dstkey, $srcpos, $dstpos): \Relay\Relay|false|string|null
4242
{
4343
return $this->initializeLazyObject()->lmove(...\func_get_args());
4444
}

src/Symfony/Component/Console/Helper/ProgressBar.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ public function getEstimated(): float
229229

230230
public function getRemaining(): float
231231
{
232-
if (!$this->step) {
232+
if (0 === $this->step || $this->step === $this->startingStep) {
233233
return 0;
234234
}
235235

src/Symfony/Component/Console/Tests/Helper/ProgressBarTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,14 @@ public function testRegularTimeEstimation()
110110
);
111111
}
112112

113+
public function testRegularTimeRemainingWithDifferentStartAtAndCustomDisplay()
114+
{
115+
ProgressBar::setFormatDefinition('custom', ' %current%/%max% [%bar%] %percent:3s%% %remaining% %estimated%');
116+
$bar = new ProgressBar($output = $this->getOutputStream(), 1_200, 0);
117+
$bar->setFormat('custom');
118+
$bar->start(1_200, 600);
119+
}
120+
113121
public function testResumedTimeEstimation()
114122
{
115123
$bar = new ProgressBar($output = $this->getOutputStream(), 1_200, 0);

0 commit comments

Comments
 (0)