8000 Merge branch '4.3' · symfony/symfony@5dba412 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5dba412

Browse files
committed
Merge branch '4.3'
* 4.3: (22 commits) [Messenger] Fix incorrect error when symfony/serializer is missing Allow WrappedListener to describe uncallable listeners. [HttpClient] fix handling exceptions thrown before first mock chunk [Filesystem] fix wrong method call casing [HttpClient] fix test [Translation] Fixed issue with new vs old TranslatorInterface in TranslationDataCollector Don't reference symfony/security [HttpClient] display proper error message on TransportException when curl is used [FrameworkBundle] fix named autowiring aliases for TagAwareCacheInterface [Cache] improve logged messages [FrameworkBundle] improve cs [Mime][HttpFoundation] Added mime type audio/x-hx-aac-adts bumped Symfony version to 4.3.0 updated VERSION for 4.3.0-BETA2 updated CHANGELOG for 4.3.0-BETA2 [HttpClient] Only use CURLMOPT_MAX_HOST_CONNECTIONS & CURL_VERSION_HTTP2 if defined [Security] fixed a fatal error when upgrading from 4.2 [HttpClient] Allow arrays as query parameters Throws UnrecoverableMessageHandlingException when passed invalid entity manager name for Doctrine middlewares [Messenger] Make redis Connection::get() non blocking by default ...
2 parents 24af4c5 + a423bad commit 5dba412

Some content is hidden

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

47 files changed

+368
-98
lines changed

CHANGELOG-4.3.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,51 @@ in 4.3 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/v4.3.0...v4.3.1
99

10+
* 4.3.0-BETA2 (2019-05-22)
11+
12+
* bug #31569 [HttpClient] Only use CURLMOPT_MAX_HOST_CONNECTIONS & CURL_VERSION_HTTP2 if defined (GawainLynch)
13+
* bug #31566 [Security] fixed a fatal error when upgrading from 4.2 (fabpot)
14+
* bug #31219 [HttpClient] Allow arrays as query parameters (sleepyboy)
15+
* bug #31482 [Messenger][DoctrineBridge] Throws UnrecoverableMessageHandlingException when passed invalid entity manager name (Koc)
16+
* feature #31471 [Messenger] Add "non sendable" stamps (weaverryan)
17+
* bug #31545 [Messenger] Fix redis Connection::get() should be non blocking by default (chalasr)
18+
* bug #31537 [Workflow] use method marking store (noniagriconomie)
19+
* bug #31551 [ProxyManager] isProxyCandidate() does not take into account interfaces (andrerom)
20+
* bug #31542 [HttpClient] add missing argument check (nicolas-grekas)
21+
* bug #31544 [Messenger] Fix undefined index on read timeout (chalasr)
22+
* bug #31335 [Doctrine] Respect parent class contract in ContainerAwareEventManager (Koc)
23+
* bug #31421 [Routing][AnnotationClassLoader] fix utf-8 encoding in default route name (przemyslaw-bogusz)
24+
* bug #31493 [EventDispatcher] Removed "callable" type hint from WrappedListener constructor (wskorodecki)
25+
* bug #31502 [WebProfilerBundle][Form] The form data collector return serialized data (Simperfit)
26+
* bug #31510 Use the current working dir as default first arg in 'link' binary (lyrixx)
27+
* bug #31524 [HttpFoundation] prevent deprecation when filesize matches error code (xabbuh)
28+
* bug #31535 [Debug] Wrap call to require_once in a try/catch (lyrixx)
29+
* feature #31030 [Serializer] Deprecate calling createChildContext without the format parameter (dbu)
30+
* bug #31459 Fix the interface incompatibility of EventDispatchers (keulinho)
31+
* bug #31463 [DI] default to service id - *not* FQCN - when building tagged locators (nicolas-grekas)
32+
* feature #31294 [Form] Add intl/choice_translation_locale option to TimezoneType (ro0NL)
33+
* feature #31452 [FrameworkBundle] Add cache configuration for PropertyInfo (alanpoulain)
34+
* feature #31486 [Doctrine][PropertyInfo] Detect if the ID is writeable (dunglas)
35+
* bug #31481 [Validator] Autovalidation: skip readonly props (dunglas)
36+
* bug #31480 Update dependencies in the main component (DavidPrevot)
37+
* bug #31477 [PropertyAccess] Add missing property to PropertyAccessor (vudaltsov)
38+
* bug #31479 [Cache] fix saving unrelated keys in recursive callback calls (nicolas-grekas)
39+
* bug #30930 [FrameworkBundle] Fixed issue when a parameter contains a '' (lyrixx)
40+
* bug #31438 [Serializer] Fix denormalization of object with variadic constructor typed argument (ajgarlag)
41+
* bug #31445 [Messenger] Making cache rebuild correctly when message subscribers change (weaverryan)
42+
* bug #31442 [Validator] Fix finding translator parent definition in compiler pass (deguif)
43+
* bug #31475 [HttpFoundation] Allow set 'None' on samesite cookie flag (markitosgv)
44+
* feature #31454 [Messenger] remove send_and_handle which can be achieved with SyncTransport (Tobion)
45+
* bug #31425 [Messenger] On failure retry, make message appear received from original sender (weaverryan)
46+
* bug #31472 [Messenger] Fix routable message bus default bus (weaverryan)
47+
* bug #31465 1241 [Serializer] Fix BC break: DEPTH_KEY_PATTERN must be public (dunglas)
48+
* bug #31458 [TwigBundle] Fix Mailer integration in Twig (fabpot)
49+
* bug #31456 Remove deprecated usage of some Twig features (fabpot)
50+
* bug #31207 [Routing] Fixed unexpected 404 NoConfigurationException (yceruto)
51+
* bug #31261 [Console] Commands with an alias should not be recognized as ambiguous when using register (Simperfit)
52+
* bug #31371 [DI] Removes number of elements information in debug mode (jschaedl)
53+
* bug #31418 [FrameworkBundle] clarify the possible class/interface of the cache (xabbuh)
54+
1055
* 4.3.0-BETA1 (2019-05-09)
1156

1257
* feature #31249 [Translator] Set sources when extracting strings from php files (Stadly)

src/Symfony/Bridge/Doctrine/Messenger/DoctrineCloseConnectionMiddleware.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
namespace Symfony\Bridge\Doctrine\Messenger;
1313

1414
use Doctrine\Common\Persistence\ManagerRegistry;
15-
use Doctrine\ORM\EntityManagerInterface;
1615
use Symfony\Component\Messenger\Envelope;
16+
use Symfony\Component\Messenger\Exception\UnrecoverableMessageHandlingException;
1717
use Symfony\Component\Messenger\Middleware\MiddlewareInterface;
1818
use Symfony\Component\Messenger\Middleware\StackInterface;
1919

@@ -40,10 +40,10 @@ public function __construct(ManagerRegistry $managerRegistry, string $entityMana
4040
*/
4141
public function handle(Envelope $envelope, StackInterface $stack): Envelope
4242
{
43-
$entityManager = $this->managerRegistry->getManager($this->entityManagerName);
44-
45-
if (!$entityManager instanceof EntityManagerInterface) {
46-
throw new \InvalidArgumentException(sprintf('The ObjectManager with name "%s" must be an instance of EntityManagerInterface', $this->entityManagerName));
43+
try {
44+
$entityManager = $this->managerRegistry->getManager($this->entityManagerName);
45+
} catch (\InvalidArgumentException $e) {
46+
throw new UnrecoverableMessageHandlingException($e->getMessage(), 0, $e);
4747
}
4848

4949
try {

src/Symfony/Bridge/Doctrine/Messenger/DoctrinePingConnectionMiddleware.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
namespace Symfony\Bridge\Doctrine\Messenger;
1313

1414
use Doctrine\Common\Persistence\ManagerRegistry;
15-
use Doctrine\ORM\EntityManagerInterface;
1615
use Symfony\Component\Messenger\Envelope;
16+
use Symfony\Component\Messenger\Exception\UnrecoverableMessageHandlingException;
1717
use Symfony\Component\Messenger\Middleware\MiddlewareInterface;
1818
use Symfony\Component\Messenger\Middleware\StackInterface;
1919

@@ -40,10 +40,10 @@ public function __construct(ManagerRegistry $managerRegistry, string $entityMana
4040
*/
4141
public function handle(Envelope $envelope, StackInterface $stack): Envelope
4242
{
43-
$entityManager = $this->managerRegistry->getManager($this->entityManagerName);
44-
45-
if (!$entityManager instanceof EntityManagerInterface) {
46-
throw new \InvalidArgumentException(sprintf('The ObjectManager with name "%s" must be an instance of EntityManagerInterface', $this->entityManagerName));
43+
try {
44+
$entityManager = $this->managerRegistry->getManager($this->entityManagerName);
45+
} catch (\InvalidArgumentException $e) {
46+
throw new UnrecoverableMessageHandlingException($e->getMessage(), 0, $e);
4747
}
4848

4949
$connection = $entityManager->getConnection();

src/Symfony/Bridge/Doctrine/Messenger/DoctrineTransactionMiddleware.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
namespace Symfony\Bridge\Doctrine\Messenger;
1313

1414
use Doctrine\Common\Persistence\ManagerRegistry;
15-
use Doctrine\ORM\EntityManagerInterface;
1615
use Symfony\Component\Messenger\Envelope;
16+
use Symfony\Component\Messenger\Exception\UnrecoverableMessageHandlingException;
1717
use Symfony\Component\Messenger\Middleware\MiddlewareInterface;
1818
use Symfony\Component\Messenger\Middleware\StackInterface;
1919

@@ -40,10 +40,10 @@ public function __construct(ManagerRegistry $managerRegistry, string $entityMana
4040
*/
4141
public function handle(Envelope $envelope, StackInterface $stack): Envelope
4242
{
43-
$entityManager = $this->managerRegistry->getManager($this->entityManagerName);
44-
45-
if (!$entityManager instanceof EntityManagerInterface) {
46-
throw new \InvalidArgumentException(sprintf('The ObjectManager with name "%s" must be an instance of EntityManagerInterface', $this->entityManagerName));
43+
try {
44+
$entityManager = $this->managerRegistry->getManager($this->entityManagerName);
45+
} catch (\InvalidArgumentException $e) {
46+
throw new UnrecoverableMessageHandlingException($e->getMessage(), 0, $e);
4747
}
4848

4949
$entityManager->getConnection()->beginTransaction();

src/Symfony/Bridge/Doctrine/Tests/Messenger/DoctrineCloseConnectionMiddlewareTest.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Doctrine\ORM\EntityManagerInterface;
1717
use Symfony\Bridge\Doctrine\Messenger\DoctrineCloseConnectionMiddleware;
1818
use Symfony\Component\Messenger\Envelope;
19+
use Symfony\Component\Messenger\Exception\UnrecoverableMessageHandlingException;
1920
use Symfony\Component\Messenger\Test\Middleware\MiddlewareTestCase;
2021

2122
class DoctrineCloseConnectionMiddlewareTest extends MiddlewareTestCase
@@ -50,4 +51,19 @@ public function testMiddlewareCloseConnection()
5051

5152
$this->middleware->handle(new Envelope(new \stdClass()), $this->getStackMock());
5253
}
54+
55+
public function testInvalidEntityManagerThrowsException()
56+
{
57+
$managerRegistry = $this->createMock(ManagerRegistry::class);
58+
$managerRegistry
59+
->method('getManager')
60+
->with('unknown_manager')
61+
->will($this->throwException(new \InvalidArgumentException()));
62+
63+
$middleware = new DoctrineCloseConnectionMiddleware($managerRegistry, 'unknown_manager');
64+
65+
$this->expectException(UnrecoverableMessageHandlingException::class);
66+
67+
$middleware->handle(new Envelope(new \stdClass()), $this->getStackMock(false));
68+
}
5369
}

src/Symfony/Bridge/Doctrine/Tests/Messenger/DoctrinePingConnectionMiddlewareTest.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Doctrine\ORM\EntityManagerInterface;
1717
use Symfony\Bridge\Doctrine\Messenger\DoctrinePingConnectionMiddleware;
1818
use Symfony\Component\Messenger\Envelope;
19+
use Symfony\Component\Messenger\Exception\UnrecoverableMessageHandlingException;
1920
use Symfony\Component\Messenger\Test\Middleware\MiddlewareTestCase;
2021

2122
class DoctrinePingConnectionMiddlewareTest extends MiddlewareTestCase
@@ -71,4 +72,19 @@ public function testMiddlewarePingResetEntityManager()
7172

7273
$this->middleware->handle(new Envelope(new \stdClass()), $this->getStackMock());
7374
}
75+
76+
public function testInvalidEntityManagerThrowsException()
77+
{
78+
$managerRegistry = $this->createMock(ManagerRegistry::class);
79+
$managerRegistry
80+
->method('getManager')
81+
->with('unknown_manager')
82+
->will($this->throwException(new \InvalidArgumentException()));
83+
84+
$middleware = new DoctrinePingConnectionMiddleware($managerRegistry, 'unknown_manager');
85+
86+
$this->expectException(UnrecoverableMessageHandlingException::class);
87+
88+
$middleware->handle(new Envelope(new \stdClass()), $this->getStackMock(false));
89+
}
7490
}

src/Symfony/Bridge/Doctrine/Tests/Messenger/DoctrineTransactionMiddlewareTest.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Doctrine\ORM\EntityManagerInterface;
1717
use Symfony\Bridge\Doctrine\Messenger\DoctrineTransactionMiddleware;
1818
use Symfony\Component\Messenger\Envelope;
19+
use Symfony\Component\Messenger\Exception\UnrecoverableMessageHandlingException;
1920
use Symfony\Component\Messenger\Test\Middleware\MiddlewareTestCase;
2021

2122
class DoctrineTransactionMiddlewareTest extends MiddlewareTestCase
@@ -67,4 +68,19 @@ public function testTransactionIsRolledBackOnException()
6768

6869
$this->middleware->handle(new Envelope(new \stdClass()), $this->getThrowingStackMock());
6970
}
71+
72+
public function testInvalidEntityManagerThrowsException()
73+
{
74+
$managerRegistry = $this->createMock(ManagerRegistry::class);
75+
$managerRegistry
76+
->method('getManager')
77+
->with('unknown_manager')
78+
->will($this->throwException(new \InvalidArgumentException()));
79+
80+
$middleware = new DoctrineTransactionMiddleware($managerRegistry, 'unknown_manager');
81+
82+
$this->expectException(UnrecoverableMessageHandlingException::class);
83+
84+
$middleware->handle(new Envelope(new \stdClass()), $this->getStackMock(false));
85+
}
7086
}

src/Symfony/Bridge/Doctrine/composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@
2929
"symfony/dependency-injection": "~3.4|~4.0",
3030
"symfony/form": "~4.3",
3131
"symfony/http-kernel": "~3.4|~4.0",
32-
"symfony/messenger": "~4.2",
32+
"symfony/messenger": "~4.3",
3333
"symfony/property-access": "~3.4|~4.0",
3434
"symfony/property-info": "~3.4|~4.0",
3535
"symfony/proxy-manager-bridge": "~3.4|~4.0",
36-
"symfony/security": "~3.4|~4.0",
36+
"symfony/security-core": "~3.4|~4.0",
3737
"symfony/expression-language": "~3.4|~4.0",
3838
"symfony/validator": "~3.4|~4.0",
3939
"symfony/translation": "~3.4|~4.0",
@@ -49,7 +49,7 @@
4949
"phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0",
5050
"symfony/dependency-injection": "<3.4",
5151
"symfony/form": "<4.3",
52-
"symfony/messenger": "<4.2"
52+
"symfony/messenger": "<4.3"
5353
},
5454
"suggest": {
5555
"symfony/form": "",

src/Symfony/Bridge/Twig/composer.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@
3434
"symfony/templating": "~3.4|~4.0",
3535
"symfony/translation": "~4.2",
3636
"symfony/yaml": "~3.4|~4.0",
37-
"symfony/security": "~3.4|~4.0",
3837
"symfony/security-acl": "~2.8|~3.0",
38+
"symfony/security-csrf": "~3.4|~4.0",
39+
"symfony/security-http": "~3.4|~4.0",
3940
"symfony/stopwatch": "~3.4|~4.0",
4041
"symfony/console": "~3.4|~4.0",
4142
"symfony/var-dumper": "~3.4|~4.0",
@@ -59,7 +60,9 @@
5960
"symfony/templating": "For using the TwigEngine",
6061
"symfony/translation": "For using the TranslationExtension",
6162
"symfony/yaml": "For using the YamlExtension",
62-
"symfony/security": "For using the SecurityExtension",
63+
"symfony/security-core": "For using the SecurityExtension",
64+
"symfony/security-csrf": "For using the CsrfExtension",
65+
"symfony/security-http": "For using the LogoutUrlExtension",
6366
"symfony/stopwatch": "For using the StopwatchExtension",
6467
"symfony/var-dumper": "For using the DumpExtension",
6568
"symfony/expression-language": "For using the ExpressionExtension",

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

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@
117117
use Symfony\Component\Yaml\Command\LintCommand as BaseYamlLintCommand;
118118
use Symfony\Component\Yaml\Yaml;
119119
use Symfony\Contracts\Cache\CacheInterface;
120+
use Symfony\Contracts\Cache\TagAwareCacheInterface;
120121
use Symfony\Contracts\HttpClient\HttpClientInterface;
121122
use Symfony\Contracts\Service\ResetInterface;
122123
use Symfony\Contracts\Service\ServiceSubscriberInterface;
@@ -737,7 +738,7 @@ private function registerWorkflowConfiguration(array $config, ContainerBuilder $
737738
}
738739

739740
if (!class_exists(Security::class)) {
740-
throw new LogicException('Cannot guard workflows as the Security component is not installed. Try running "composer require symfony/security".');
741+
throw new LogicException('Cannot guard workflows as the Security component is not installed. Try running "composer require symfony/security-core".');
741742
}
742743

743744
$guard = new Definition(Workflow\EventListener\GuardListener::class);
@@ -1819,13 +1820,9 @@ private function registerCacheConfiguration(array $config, ContainerBuilder $con
18191820
$pool['adapter'] = '.'.$pool['adapter'].'.inner';
18201821
}
18211822
$definition = new ChildDefinition($pool['adapter']);
1822-
if (!\in_array($name, ['cache.app', 'cache.system'], true)) {
1823-
$container->registerAliasForArgument($name, CacheInterface::class);
1824-
$container->registerAliasForArgument($name, CacheItemPoolInterface::class);
1825-
}
18261823

18271824
if ($pool['tags']) {
1828-
if ($config['pools'][$pool['tags']]['tags'] ?? false) {
1825+
if (true !== $pool['tags'] && ($config['pools'][$pool['tags']]['tags'] ?? false)) {
18291826
$pool['tags'] = '.'.$pool['tags'].'.inner';
18301827
}
18311828
$container->register($name, TagAwareAdapter::class)
@@ -1837,7 +1834,21 @@ private function registerCacheConfiguration(array $config, ContainerBuilder $con
18371834
$pool['name'] = $name;
18381835
$pool['public'] = false;
18391836
$name = '.'.$name.'.inner';
1837+
1838+
if (!\in_array($pool['name'], ['cache.app', 'cache.system'], true)) {
1839+
$container->registerAliasForArgument($pool['name'], TagAwareCacheInterface::class);
1840+
$container->registerAliasForArgument($name, CacheInterface::class, $pool['name']);
1841+
$container->registerAliasForArgument($name, CacheItemPoolInterface::class, $pool['name']);
1842+
}
1843+
} elseif (!\in_array($name, ['cache.app', 'cache.system'], true)) {
1844+
$container->register('.'.$name.'.taggable', TagAwareAdapter::class)
1845+
->addArgument(new Reference($name))
1846+
;
1847+
$container->registerAliasForArgument('.'.$name.'.taggable', TagAwareCacheInterface::class, $name);
1848+
$container->registerAliasForArgument($name, CacheInterface::class);
1849+
$container->registerAliasForArgument($name, CacheItemPoolInterface::class);
18401850
}
1851+
18411852
$definition->setPublic($pool['public']);
18421853
unset($pool['adapter'], $pool['public'], $pool['tags']);
18431854

src/Symfony/Bundle/FrameworkBundle/composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,15 @@
3838
"symfony/css-selector": "~3.4|~4.0",
3939
"symfony/dom-crawler": "^4.3",
4040
"symfony/polyfill-intl-icu": "~1.0",
41-
"symfony/security": "~3.4|~4.0",
4241
"symfony/form": "^4.3",
4342
"symfony/expression-language": "~3.4|~4.0",
4443
"symfony/http-client": "^4.3",
4544
"symfony/mailer": "^4.3",
4645
"symfony/messenger": "^4.3",
4746
"symfony/mime": "^4.3",
4847
"symfony/process": "~3.4|~4.0",
49-
"symfony/security-core": "~3.4|~4.0",
5048
"symfony/security-csrf": "~3.4|~4.0",
49+
"symfony/security-http": "~3.4|~4.0",
5150
"symfony/serializer": "^4.3",
5251
"symfony/stopwatch": "~3.4|~4.0",
5352
"symfony/translation": "~4.2",

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,8 @@ public function deleteItems(array $keys)
253253
}
254254
} catch (\Exception $e) {
255255
}
256-
CacheItem::log($this->logger, 'Failed to delete key "{key}"', ['key' => $key, 'exception' => $e]);
256+
$message = 'Failed to delete key "{key}"'.($e instanceof \Exception ? ': '.$e->getMessage() : '.');
257+
CacheItem::log($this->logger, $message, ['key' => $key, 'exception' => $e]);
257258
$ok = false;
258259
}
259260

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ private function redisServerSupportSPOP(): bool
198198
$info = $host->info('Server');
199199
$info = isset($info['Server']) ? $info['Server'] : $info;
200200
if (version_compare($info['redis_version'], '3.2', '<')) {
201-
CacheItem::log($this->logger, 'Redis server needs to be version 3.2 or higher, your Redis server was detected as {version}', ['version' => $info['redis_version']]);
201+
CacheItem::log($this->logger, 'Redis server needs to be version 3.2 or higher, your Redis server was detected as '.$info['redis_version']);
202202

203203
return $this->redisServerSupportSPOP = false;
204204
}

0 commit comments

Comments
 (0)
0