Merge branch '4.1'

* 4.1:
  fix merge
  bumped Symfony version to 4.1.3
  [PhpUnitBridge] Describe weak_vendors properly
  [HttpKernel] Fix merging bindings for controllers' locators
  updated VERSION for 4.1.2
  updated CHANGELOG for 4.1.2
  bumped Symfony version to 4.0.14
  updated VERSION for 4.0.13
  updated CHANGELOG for 4.0.13
  bumped Symfony version to 3.4.14
  updated VERSION for 3.4.13
  updated CHANGELOG for 3.4.13
  bumped Symfony version to 2.8.44
  Chaining senders with their aliases should work
This commit is contained in:
Nicolas Grekas 2018-07-26 10:29:03 +02:00
commit 1730b7d9ef
10 changed files with 143 additions and 20 deletions

View File

@ -7,6 +7,40 @@ in 4.0 minor versions.
To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash
To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v4.0.0...v4.0.1
* 4.0.13 (2018-07-23)
* bug #28005 [HttpKernel] Fixed templateExists on parse error of the template name (yceruto)
* bug #27997 Serbo-Croatian has Serbian plural rule (kylekatarnls)
* bug #26193 Fix false-positive deprecation notices for TranslationLoader and WriteCheckSessionHandler (iquito)
* bug #27941 [WebProfilerBundle] Fixed icon alignment issue using Bootstrap 4.1.2 (jmsche)
* bug #27937 [HttpFoundation] reset callback on StreamedResponse when setNotModified() is called (rubencm)
* bug #27927 [HttpFoundation] Suppress side effects in 'get' and 'has' methods of NamespacedAttributeBag (webnet-fr)
* bug #27923 [Form/Profiler] Massively reducing memory footprint of form profiling pages... (VincentChalnot)
* bug #27918 [Console] correctly return parameter's default value on "--" (seschwar)
* bug #27904 [Filesystem] fix lock file permissions (fritzmg)
* bug #27903 [Lock] fix lock file permissions (fritzmg)
* bug #27889 [Form] Replace .initialism with .text-uppercase. (vudaltsov)
* bug #27902 Fix the detection of the Process new argument (stof)
* bug #27885 [HttpFoundation] don't encode cookie name for BC (nicolas-grekas)
* bug #27782 [DI] Fix dumping ignore-on-uninitialized references to synthetic services (nicolas-grekas)
* bug #27435 [OptionResolver] resolve arrays (Doctrs)
* bug #27728 [TwigBridge] Fix missing path and separators in loader paths list on debug:twig output (yceruto)
* bug #27837 [PropertyInfo] Fix dock block lookup fallback loop (DerManoMann)
* bug #27758 [WebProfilerBundle] Prevent toolbar links color override by css (alcalyn)
* bug #27847 [Security] Fix accepting null as $uidKey in LdapUserProvider (louhde)
* bug #27834 [DI] Don't show internal service id on binding errors (nicolas-grekas)
* bug #27831 Check for Hyper terminal on all operating systems. (azjezz)
* bug #27794 Add color support for Hyper terminal . (azjezz)
* bug #27809 [HttpFoundation] Fix tests: new message for status 425 (dunglas)
* bug #27618 [PropertyInfo] added handling of nullable types in PhpDoc (oxan)
* bug #27659 [HttpKernel] Make AbstractTestSessionListener compatible with CookieClearingLogoutHandler (thewilkybarkid)
* bug #27752 [Cache] provider does not respect option maxIdLength with versioning enabled (Constantine Shtompel)
* bug #27776 [ProxyManagerBridge] Fix support of private services (bis) (nicolas-grekas)
* bug #27714 [HttpFoundation] fix session tracking counter (nicolas-grekas, dmaicher)
* bug #27747 [HttpFoundation] fix registration of session proxies (nicolas-grekas)
* bug #27722 Redesign the Debug error page in prod (javiereguiluz)
* bug #27716 [DI] fix dumping deprecated service in yaml (nicolas-grekas)
* 4.0.12 (2018-06-25)
* bug #27626 [TwigBundle][DX] Only add the Twig WebLinkExtension if the WebLink component is enabled (thewilkybarkid)

View File

@ -7,6 +7,53 @@ in 4.1 minor versions.
To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash
To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v4.1.0...v4.1.1
* 4.1.2 (2018-07-23)
* bug #28005 [HttpKernel] Fixed templateExists on parse error of the template name (yceruto)
* bug #28013 [Messenger] Add missing typehint on chain sender (sroze)
* bug #27997 Serbo-Croatian has Serbian plural rule (kylekatarnls)
* bug #26193 Fix false-positive deprecation notices for TranslationLoader and WriteCheckSessionHandler (iquito)
* bug #27827 [Serializer] Supports nested abstract items (sroze)
* bug #27958 [Form] Remaining changes for bootstrap 4 file fields (apfelbox)
* bug #27919 [Form] Improve rendering of `file` field in bootstrap 4 (apfelbox)
* bug #27941 [WebProfilerBundle] Fixed icon alignment issue using Bootstrap 4.1.2 (jmsche)
* bug #27937 [HttpFoundation] reset callback on StreamedResponse when setNotModified() is called (rubencm)
* bug #27927 [HttpFoundation] Suppress side effects in 'get' and 'has' methods of NamespacedAttributeBag (webnet-fr)
* bug #27913 [EventDispatcher] Clear orphaned events on reset (acasademont)
* bug #27923 [Form/Profiler] Massively reducing memory footprint of form profiling pages... (VincentChalnot)
* bug #27918 [Console] correctly return parameter's default value on "--" (seschwar)
* bug #27826 [Serializer] Fix serialization of items with groups across entities and discrimination map (sroze)
* bug #27904 [Filesystem] fix lock file permissions (fritzmg)
* bug #27903 [Lock] fix lock file permissions (fritzmg)
* bug #27889 [Form] Replace .initialism with .text-uppercase. (vudaltsov)
* bug #27902 Fix the detection of the Process new argument (stof)
* bug #27885 [HttpFoundation] don't encode cookie name for BC (nicolas-grekas)
* bug #27782 [DI] Fix dumping ignore-on-uninitialized references to synthetic services (nicolas-grekas)
* bug #27435 [OptionResolver] resolve arrays (Doctrs)
* bug #27728 [TwigBridge] Fix missing path and separators in loader paths list on debug:twig output (yceruto)
* bug #27837 [PropertyInfo] Fix dock block lookup fallback loop (DerManoMann)
* bug #27848 [Workflow] Fixed BC break (lyrixx)
* bug #27758 [WebProfilerBundle] Prevent toolbar links color override by css (alcalyn)
* bug #27847 [Security] Fix accepting null as $uidKey in LdapUserProvider (louhde)
* bug #27820 [Messenger] Fix a bug when having more than one named handler per message subscriber (sroze)
* bug #27834 [DI] Don't show internal service id on binding errors (nicolas-grekas)
* bug #27831 Check for Hyper terminal on all operating systems. (azjezz)
* bug #27794 Add color support for Hyper terminal . (azjezz)
* bug #27809 [HttpFoundation] Fix tests: new message for status 425 (dunglas)
* bug #27618 [PropertyInfo] added handling of nullable types in PhpDoc (oxan)
* bug #27659 [HttpKernel] Make AbstractTestSessionListener compatible with CookieClearingLogoutHandler (thewilkybarkid)
* bug #27752 [Cache] provider does not respect option maxIdLength with versioning enabled (Constantine Shtompel)
* bug #27773 [Serializer] Class discriminator and serialization groups (sroze)
* bug #27710 [DependencyInjection] fix handling of empty DI extension configs (xabbuh)
* bug #27776 [ProxyManagerBridge] Fix support of private services (bis) (nicolas-grekas)
* bug #27714 [HttpFoundation] fix session tracking counter (nicolas-grekas, dmaicher)
* bug #27727 [Routing] Disallow object usage inside Route (paxal)
* bug #27736 [Routing] fix too much greediness in host-matching regex (nicolas-grekas)
* bug #27747 [HttpFoundation] fix registration of session proxies (nicolas-grekas)
* bug #27754 [HttpFoundation] missing namespace for RedisProxy (Bonfante)
* bug #27722 Redesign the Debug error page in prod (javiereguiluz)
* bug #27716 [DI] fix dumping deprecated service in yaml (nicolas-grekas)
* 4.1.1 (2018-06-25)
* bug #27626 [TwigBundle][DX] Only add the Twig WebLinkExtension if the WebLink component is enabled (thewilkybarkid)

View File

@ -29,7 +29,7 @@ class DeprecationErrorHandler
*
* The following reporting modes are supported:
* - use "weak" to hide the deprecation report but keep a global count;
* - use "weak_vendors" to act as "weak" but only for vendors;
* - use "weak_vendors" to fail only on deprecations triggered in your own code;
* - use "/some-regexp/" to stop the test suite whenever a deprecation
* message matches the given regular expression;
* - use a number to define the upper bound of allowed deprecations,
@ -80,7 +80,7 @@ class DeprecationErrorHandler
return true;
}
foreach ($vendors as $vendor) {
if (0 === strpos($realPath, $vendor) && false !== strpbrk(substr($realPath, strlen($vendor), 1), '/'.DIRECTORY_SEPARATOR)) {
if (0 === strpos($realPath, $vendor) && false !== strpbrk(substr($realPath, strlen($vendor), 1), '/'.\DIRECTORY_SEPARATOR)) {
return true;
}
}
@ -159,7 +159,7 @@ class DeprecationErrorHandler
echo "\n".ucfirst($group).' deprecation triggered by '.$class.'::'.$method.':';
echo "\n".$msg;
echo "\nStack trace:";
echo "\n".str_replace(' '.getcwd().DIRECTORY_SEPARATOR, ' ', $e->getTraceAsString());
echo "\n".str_replace(' '.getcwd().\DIRECTORY_SEPARATOR, ' ', $e->getTraceAsString());
echo "\n";
exit(1);
@ -315,7 +315,7 @@ class DeprecationErrorHandler
return true;
}
if (DIRECTORY_SEPARATOR === '\\') {
if (\DIRECTORY_SEPARATOR === '\\') {
return (function_exists('sapi_windows_vt100_support')
&& sapi_windows_vt100_support(STDOUT))
|| false !== getenv('ANSICON')

View File

@ -1511,6 +1511,22 @@ class FrameworkExtension extends Extension
throw new LogicException(sprintf('The default bus named "%s" is not defined. Define it or change the default bus name.', $config['default_bus']));
}
$senderAliases = array();
foreach ($config['transports'] as $name => $transport) {
if (0 === strpos($transport['dsn'], 'amqp://') && !$container->hasDefinition('messenger.transport.amqp.factory')) {
throw new LogicException('The default AMQP transport is not available. Make sure you have installed and enabled the Serializer component. Try enable it or install it by running "composer require symfony/serializer-pack".');
}
$transportDefinition = (new Definition(TransportInterface::class))
->setFactory(array(new Reference('messenger.transport_factory'), 'createTransport'))
->setArguments(array($transport['dsn'], $transport['options']))
->addTag('messenger.receiver', array('alias' => $name))
->addTag('messenger.sender', array('alias' => $name))
;
$container->setDefinition($transportId = 'messenger.transport.'.$name, $transportDefinition);
$senderAliases[$name] = $transportId;
}
$messageToSenderIdMapping = array();
$messageToSendAndHandleMapping = array();
foreach ($config['routing'] as $message => $messageConfiguration) {
@ -1519,8 +1535,11 @@ class FrameworkExtension extends Extension
}
if (1 < \count($messageConfiguration['senders'])) {
$senders = array_map(function ($sender) { return new Reference($sender); }, $messageConfiguration['senders']);
$senders = array_map(function ($sender) use ($senderAliases) {
return new Reference($senderAliases[$sender] ?? $sender);
}, $messageConfiguration['senders']);
$chainSenderDefinition = new Definition(ChainSender::class, array($senders));
$chainSenderDefinition->addTag('messenger.sender');
$chainSenderId = '.messenger.chain_sender.'.$message;
$container->setDefinition($chainSenderId, $chainSenderDefinition);
$messageToSenderIdMapping[$message] = $chainSenderId;
@ -1533,20 +1552,6 @@ class FrameworkExtension extends Extension
$container->getDefinition('messenger.asynchronous.routing.sender_locator')->replaceArgument(1, $messageToSenderIdMapping);
$container->getDefinition('messenger.middleware.route_messages')->replaceArgument(1, $messageToSendAndHandleMapping);
foreach ($config['transports'] as $name => $transport) {
if (0 === strpos($transport['dsn'], 'amqp://') && !$container->hasDefinition('messenger.transport.amqp.factory')) {
throw new LogicException('The default AMQP transport is not available. Make sure you have installed and enabled the Serializer component. Try enable it or install it by running "composer require symfony/serializer-pack".');
}
$transportDefinition = (new Definition(TransportInterface::class))
->setFactory(array(new Reference('messenger.transport_factory'), 'createTransport'))
->setArguments(array($transport['dsn'], $transport['options']))
->addTag('messenger.receiver', array('alias' => $name))
->addTag('messenger.sender', array('alias' => $name))
;
$container->setDefinition('messenger.transport.'.$name, $transportDefinition);
}
}
private function registerCacheConfiguration(array $config, ContainerBuilder $container)

View File

@ -1,7 +1,9 @@
<?php
$container->loadFromExtension('framework', array(
'serializer' => true,
'messenger' => array(
'serializer' => true,
'routing' => array(
'Symfony\Component\Messenger\Tests\Fixtures\DummyMessage' => array('amqp', 'audit'),
'Symfony\Component\Messenger\Tests\Fixtures\SecondMessage' => array(
@ -10,5 +12,8 @@ $container->loadFromExtension('framework', array(
),
'*' => 'amqp',
),
'transports' => array(
'amqp' => 'amqp://localhost/%2f/messages',
),
),
));

View File

@ -6,7 +6,9 @@
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
<framework:config>
<framework:serializer enabled="true" />
<framework:messenger>
<framework:serializer enabled="true" />
<framework:routing message-class="Symfony\Component\Messenger\Tests\Fixtures\DummyMessage">
<framework:sender service="amqp" />
<framework:sender service="audit" />
@ -18,6 +20,7 @@
<framework:routing message-class="*">
<framework:sender service="amqp" />
</framework:routing>
<framework:transport name="amqp" dsn="amqp://localhost/%2f/messages" />
</framework:messenger>
</framework:config>
</container>

View File

@ -1,8 +1,12 @@
framework:
serializer: true
messenger:
serializer: true
routing:
'Symfony\Component\Messenger\Tests\Fixtures\DummyMessage': [amqp, audit]
'Symfony\Component\Messenger\Tests\Fixtures\SecondMessage':
senders: [amqp, audit]
send_and_handle: true
'*': amqp
transports:
amqp: 'amqp://localhost/%2f/messages'

View File

@ -573,6 +573,7 @@ abstract class FrameworkExtensionTest extends TestCase
$this->assertSame($messageToSenderIdsMapping, $senderLocatorDefinition->getArgument(1));
$this->assertSame($messageToSendAndHandleMapping, $sendMessageMiddlewareDefinition->getArgument(1));
$this->assertEquals(array(new Reference('messenger.transport.amqp'), new Reference('audit')), $container->getDefinition('.messenger.chain_sender.'.DummyMessage::class)->getArgument(0));
}
/**

View File

@ -62,7 +62,7 @@ class RegisterControllerArgumentLocatorsPass implements CompilerPassInterface
while ($def instanceof ChildDefinition) {
$def = $container->findDefinition($def->getParent());
$class = $class ?: $def->getClass();
$bindings = $def->getBindings();
$bindings += $def->getBindings();
}
$class = $parameterBag->resolveValue($class);

View File

@ -13,6 +13,7 @@ namespace Symfony\Component\HttpKernel\Tests\DependencyInjection;
use PHPUnit\Framework\TestCase;
use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument;
use Symfony\Component\DependencyInjection\ChildDefinition;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
use Symfony\Component\DependencyInjection\ContainerBuilder;
@ -352,6 +353,29 @@ class RegisterControllerArgumentLocatorsPassTest extends TestCase
yield array('$someArg');
yield array('string $someArg');
}
public function testBindingsOnChildDefinitions()
{
$container = new ContainerBuilder();
$resolver = $container->register('argument_resolver.service')->addArgument(array());
$container->register('parent', ArgumentWithoutTypeController::class);
$container->setDefinition('child', (new ChildDefinition('parent'))
->setBindings(array('$someArg' => new Reference('parent')))
->addTag('controller.service_arguments')
);
$pass = new RegisterControllerArgumentLocatorsPass();
$pass->process($container);
$locator = $container->getDefinition((string) $resolver->getArgument(0))->getArgument(0);
$this->assertInstanceOf(ServiceClosureArgument::class, $locator['child::fooAction']);
$locator = $container->getDefinition((string) $locator['child::fooAction']->getValues()[0])->getArgument(0);
$this->assertInstanceOf(ServiceClosureArgument::class, $locator['someArg']);
$this->assertEquals(new Reference('parent'), $locator['someArg']->getValues()[0]);
}
}
class RegisterTestController