Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 04d78d8

Browse files
Merge branch '6.4' into 7.0
* 6.4: [Scheduler] Fix `PeriodicalTrigger` from argument for stateful run dates cs fix [Messenger] Fix passing options set via tags to handler descriptors random_bytes length should be an int greater than 0 enforce UTC timezone in test [DependencyInjection] Fix autocasting null env values to empty string Fix executable bit Fix executable bit Readme: Replace Stack Overflow with GitHub Discussions [DoctrineBridge] Remove outdated comment [DependencyInjection] Fix annotation [DoctrineBridge] Improve subscriber deprecation message [SecurityBundle] Do not translate `Bearer` header’s `error_description` [Lock] add missing UPGRADE and CHANGELOG Lock mention #50689 [String] Fix Inflector for 'status' [DependencyInjection] Fix resource tracking for lazy services [EventDispatcher] [EventDispatcher] Throw exception when listener method cannot be resolved [Serializer] Fix type error not be accessed before initialization
2 parents 7e89741 + 98d91e1 commit 04d78d8

File tree

33 files changed

+180
-43
lines changed

33 files changed

+180
-43
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ Community
5757
---------
5858

5959
* [Join the Symfony Community][11] and meet other members at the [Symfony events][12].
60-
* [Get Symfony support][13] on Stack Overflow, Slack, IRC, etc.
60+
* [Get Symfony support][13] on GitHub Discussions, Slack, etc.
6161
* Follow us on [GitHub][14], [Twitter][15] and [Facebook][16].
6262
* Read our [Code of Conduct][24] and meet the [CARE Team][25].
6363

UPGRADE-6.3.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ Lock
101101
----
102102

103103
* Deprecate the `gcProbablity` option to fix a typo in its name, use the `gcProbability` option instead
104+
* Add optional parameter `$isSameDatabase` to `DoctrineDbalStore::configureSchema()`
104105

105106
Messenger
106107
---------

src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ private function addTaggedServices(ContainerBuilder $container): array
106106
$refs = $managerDef->getArguments()[1] ?? [];
107107
$listenerRefs[$con][$id] = new Reference($id);
108108
if ($subscriberTag === $tagName) {
109-
trigger_deprecation('symfony/doctrine-bridge', '6.3', 'Using Doctrine subscribers as services is deprecated, declare listeners instead');
109+
trigger_deprecation('symfony/doctrine-bridge', '6.3', 'Registering "%s" as a Doctrine subscriber is deprecated. Register it as a listener instead, using e.g. the #[AsDoctrineListener] attribute.', $id);
110110
$refs[] = $id;
111111
} else {
112112
$refs[] = [[$tag['event']], $id];

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,6 @@ protected function loadChoices(): iterable
5757
: $this->manager->getRepository($this->class)->findAll();
5858
}
5959

60-
/**
61-
* @internal to be remove in Symfony 6
62-
*/
6360
protected function doLoadValuesForChoices(array $choices): array
6461
{
6562
// Optimize performance for single-field identifiers. We already

src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPassTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ public function testProcessEventSubscribersWithMultipleConnections()
238238
])
239239
;
240240

241-
$this->expectDeprecation('Since symfony/doctrine-bridge 6.3: Using Doctrine subscribers as services is deprecated, declare listeners instead');
241+
$this->expectDeprecation('Since symfony/doctrine-bridge 6.3: Registering "d" as a Doctrine subscriber is deprecated. Register it as a listener instead, using e.g. the #[AsDoctrineListener] attribute.');
242242
$this->process($container);
243243

244244
$eventManagerDef = $container->getDefinition('doctrine.dbal.default_connection.event_manager');
@@ -322,7 +322,7 @@ public function testProcessEventSubscribersWithPriorities()
322322
])
323323
;
324324

325-
$this->expectDeprecation('Since symfony/doctrine-bridge 6.3: Using Doctrine subscribers as services is deprecated, declare listeners instead');
325+
$this->expectDeprecation('Since symfony/doctrine-bridge 6.3: Registering "d" as a Doctrine subscriber is deprecated. Register it as a listener instead, using e.g. the #[AsDoctrineListener] attribute.');
326326
$this->process($container);
327327

328328
$eventManagerDef = $container->getDefinition('doctrine.dbal.default_connection.event_manager');
@@ -416,7 +416,7 @@ public function testProcessEventSubscribersAndListenersWithPriorities()
416416
])
417417
;
418418

419-
$this->expectDeprecation('Since symfony/doctrine-bridge 6.3: Using Doctrine subscribers as services is deprecated, declare listeners instead');
419+
$this->expectDeprecation('Since symfony/doctrine-bridge 6.3: Registering "d" as a Doctrine subscriber is deprecated. Register it as a listener instead, using e.g. the #[AsDoctrineListener] attribute.');
420420
$this->process($container);
421421

422422
$eventManagerDef = $container->getDefinition('doctrine.dbal.default_connection.event_manager');

src/Symfony/Bundle/SecurityBundle/Resources/config/security_authenticator_access_token.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
null,
4343
null,
4444
])
45-
->call('setTranslator', [service('translator')->ignoreOnInvalid()])
4645

4746
->set('security.authenticator.access_token.chain_extractor', ChainAccessTokenExtractor::class)
4847
->abstract()

src/Symfony/Component/DependencyInjection/Container.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,15 @@ protected function getEnv(string $name): mixed
372372
$prefix = 'string';
373373
$localName = $name;
374374
}
375-
$processor = $processors->has($prefix) ? $processors->get($prefix) : new EnvVarProcessor($this);
375+
376+
if ($processors->has($prefix)) {
377+
$processor = $processors->get($prefix);
378+
} else {
379+
$processor = new EnvVarProcessor($this);
380+
if (false === $i) {
381+
$prefix = '';
382+
}
383+
}
376384

377385
$this->resolving[$envName] = true;
378386
try {

src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Component\DependencyInjection\Dumper;
1313

1414
use Composer\Autoload\ClassLoader;
15+
use Symfony\Component\Config\Resource\FileResource;
1516
use Symfony\Component\DependencyInjection\Argument\AbstractArgument;
1617
use Symfony\Component\DependencyInjection\Argument\ArgumentInterface;
1718
use Symfony\Component\DependencyInjection\Argument\IteratorArgument;
@@ -568,8 +569,19 @@ private function generateProxyClasses(): array
568569
continue;
569570
}
570571
$alreadyGenerated[$asGhostObject][$class] = true;
571-
// register class' reflector for resource tracking
572-
$this->container->getReflectionClass($class);
572+
573+
$r = $this->container->getReflectionClass($class);
574+
do {
575+
$file = $r->getFileName();
576+
if (str_ends_with($file, ') : eval()\'d code')) {
577+
$file = substr($file, 0, strrpos($file, '(', -17));
578+
}
579+
if (is_file($file)) {
580+
$this->container->addResource(new FileResource($file));
581+
}
582+
$r = $r->getParentClass() ?: null;
583+
} while ($r?->isUserDefined());
584+
573585
if ("\n" === $proxyCode = "\n".$proxyDumper->getProxyCode($definition, $id)) {
574586
continue;
575587
}

src/Symfony/Component/DependencyInjection/EnvVarProcessor.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,12 @@ public function getEnv(string $prefix, string $name, \Closure $getEnv): mixed
152152
}
153153
}
154154

155+
$returnNull = false;
156+
if ('' === $prefix) {
157+
$returnNull = true;
158+
$prefix = 'string';
159+
}
160+
155161
if (false !== $i || 'string' !== $prefix) {
156162
$env = $getEnv($name);
157163
} elseif ('' === ($env = $_ENV[$name] ?? (str_starts_with($name, 'HTTP_') ? null : ($_SERVER[$name] ?? null)))
@@ -201,6 +207,10 @@ public function getEnv(string $prefix, string $name, \Closure $getEnv): mixed
201207
}
202208

203209
if (null === $env) {
210+
if ($returnNull) {
211+
return null;
212+
}
213+
204214
if (!isset($this->getProvidedTypes()[$prefix])) {
205215
throw new RuntimeException(sprintf('Unsupported env var prefix "%s".', $prefix));
206216
}

src/Symfony/Component/DependencyInjection/Tests/EnvVarProcessorTest.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -910,12 +910,13 @@ public static function provideGetEnvUrlPath()
910910

911911
/**
912912
* @testWith ["", "string"]
913+
* [null, ""]
913914
* [false, "bool"]
914915
* [true, "not"]
915916
* [0, "int"]
916917
* [0.0, "float"]
917918
*/
918-
public function testGetEnvCastsNull($expected, string $prefix)
919+
public function testGetEnvCastsNullBehavior($expected, string $prefix)
919920
{
920921
$processor = new EnvVarProcessor(new Container());
921922

@@ -926,6 +927,19 @@ public function testGetEnvCastsNull($expected, string $prefix)
926927
}));
927928
}
928929

930+
public function testGetEnvWithEmptyStringPrefixCastsToString()
931+
{
932+
$processor = new EnvVarProcessor(new Container());
933+
unset($_ENV['FOO']);
934+
$_ENV['FOO'] = 4;
935+
936+
try {
937+
$this->assertSame('4', $processor->getEnv('', 'FOO', function () { $this->fail('Should not be called'); }));
938+
} finally {
939+
unset($_ENV['FOO']);
940+
}
941+
}
942+
929943
/**
930944
* @dataProvider provideGetEnvDefined
931945
*/

0 commit comments

Comments
 (0)