From e580c68899921119e17b6774ef467406eb3b5f8b Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 3 Apr 2017 21:47:45 -0700 Subject: [PATCH 01/51] bumped Symfony version to 2.7.27 --- src/Symfony/Component/HttpKernel/Kernel.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 7e911bddfaaae..0d37a6d05e409 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -58,12 +58,12 @@ abstract class Kernel implements KernelInterface, TerminableInterface protected $startTime; protected $loadClassCache; - const VERSION = '2.7.26'; - const VERSION_ID = 20726; + const VERSION = '2.7.27-DEV'; + const VERSION_ID = 20727; const MAJOR_VERSION = 2; const MINOR_VERSION = 7; - const RELEASE_VERSION = 26; - const EXTRA_VERSION = ''; + const RELEASE_VERSION = 27; + const EXTRA_VERSION = 'DEV'; const END_OF_MAINTENANCE = '05/2018'; const END_OF_LIFE = '05/2019'; From fffcd247b22f830330c277e4876aaf8772615e38 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sat, 18 Mar 2017 10:10:35 +0100 Subject: [PATCH 02/51] fix some risky tests --- .../Builder/ArrayNodeDefinitionTest.php | 9 +- .../Definition/Builder/TreeBuilderTest.php | 13 ++- .../Config/Tests/Fixtures/BarNode.php | 18 ++++ .../Fixtures/Builder/BarNodeDefinition.php | 2 + .../Component/Form/Tests/CompoundFormTest.php | 2 + .../Extension/Core/Type/ChoiceTypeTest.php | 8 +- .../Extension/Core/Type/CountryTypeTest.php | 8 +- .../Extension/Core/Type/DateTimeTypeTest.php | 2 +- .../Extension/Core/Type/DateTypeTest.php | 2 +- .../Extension/Core/Type/FormTypeTest.php | 14 +-- .../Extension/Core/Type/TimeTypeTest.php | 2 +- .../DependencyInjectionExtensionTest.php | 9 +- .../Component/Form/Tests/FormBuilderTest.php | 2 + .../Component/Form/Tests/FormConfigTest.php | 102 +++++++++--------- .../Component/Form/Tests/SimpleFormTest.php | 17 +-- .../Form/Tests/Util/OrderedHashMapTest.php | 3 + .../HttpFoundation/Tests/IpUtilsTest.php | 8 +- .../Tests/RequestMatcherTest.php | 8 +- .../HttpFoundation/Tests/RequestTest.php | 51 ++++----- .../Tests/Session/SessionTest.php | 2 + .../Tests/Session/Storage/MetadataBagTest.php | 3 + .../Tests/StreamedResponseTest.php | 4 +- .../Acl/Tests/Dbal/MutableAclProviderTest.php | 39 ++++--- .../Domain/PermissionGrantingStrategyTest.php | 11 +- .../Encoder/BCryptPasswordEncoderTest.php | 17 ++- .../Core/Tests/LegacySecurityContextTest.php | 3 +- .../Http/Tests/Firewall/DigestDataTest.php | 13 ++- 27 files changed, 222 insertions(+), 150 deletions(-) create mode 100644 src/Symfony/Component/Config/Tests/Fixtures/BarNode.php diff --git a/src/Symfony/Component/Config/Tests/Definition/Builder/ArrayNodeDefinitionTest.php b/src/Symfony/Component/Config/Tests/Definition/Builder/ArrayNodeDefinitionTest.php index 6456639af305e..63efd719b5f59 100644 --- a/src/Symfony/Component/Config/Tests/Definition/Builder/ArrayNodeDefinitionTest.php +++ b/src/Symfony/Component/Config/Tests/Definition/Builder/ArrayNodeDefinitionTest.php @@ -145,13 +145,16 @@ public function providePrototypedArrayNodeDefaults() public function testNestedPrototypedArrayNodes() { - $node = new ArrayNodeDefinition('root'); - $node + $nodeDefinition = new ArrayNodeDefinition('root'); + $nodeDefinition ->addDefaultChildrenIfNoneSet() ->prototype('array') ->prototype('array') ; - $node->getNode(); + $node = $nodeDefinition->getNode(); + + $this->assertInstanceOf('Symfony\Component\Config\Definition\PrototypedArrayNode', $node); + $this->assertInstanceOf('Symfony\Component\Config\Definition\PrototypedArrayNode', $node->getPrototype()); } public function testEnabledNodeDefaults() diff --git a/src/Symfony/Component/Config/Tests/Definition/Builder/TreeBuilderTest.php b/src/Symfony/Component/Config/Tests/Definition/Builder/TreeBuilderTest.php index 16a10227cc296..13304fae36e95 100644 --- a/src/Symfony/Component/Config/Tests/Definition/Builder/TreeBuilderTest.php +++ b/src/Symfony/Component/Config/Tests/Definition/Builder/TreeBuilderTest.php @@ -71,6 +71,8 @@ public function testPrototypedArrayNodeUseTheCustomNodeBuilder() $root = $builder->root('override', 'array', new CustomNodeBuilder()); $root->prototype('bar')->end(); + + $this->assertInstanceOf('Symfony\Component\Config\Tests\Fixtures\BarNode', $root->getNode(true)->getPrototype()); } public function testAnExtendedNodeBuilderGetsPropagatedToTheChildren() @@ -79,7 +81,7 @@ public function testAnExtendedNodeBuilderGetsPropagatedToTheChildren() $builder->root('propagation') ->children() - ->setNodeClass('extended', 'Symfony\Component\Config\Tests\Definition\Builder\VariableNodeDefinition') + ->setNodeClass('extended', 'Symfony\Component\Config\Definition\Builder\BooleanNodeDefinition') ->node('foo', 'extended')->end() ->arrayNode('child') ->children() @@ -88,6 +90,15 @@ public function testAnExtendedNodeBuilderGetsPropagatedToTheChildren() ->end() ->end() ->end(); + + $node = $builder->buildTree(); + $children = $node->getChildren(); + + $this->assertInstanceOf('Symfony\Component\Config\Definition\BooleanNode', $children['foo']); + + $childChildren = $children['child']->getChildren(); + + $this->assertInstanceOf('Symfony\Component\Config\Definition\BooleanNode', $childChildren['foo']); } public function testDefinitionInfoGetsTransferredToNode() diff --git a/src/Symfony/Component/Config/Tests/Fixtures/BarNode.php b/src/Symfony/Component/Config/Tests/Fixtures/BarNode.php new file mode 100644 index 0000000000000..0b9c32dedaf1f --- /dev/null +++ b/src/Symfony/Component/Config/Tests/Fixtures/BarNode.php @@ -0,0 +1,18 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Config\Tests\Fixtures; + +use Symfony\Component\Config\Definition\ArrayNode; + +class BarNode extends ArrayNode +{ +} diff --git a/src/Symfony/Component/Config/Tests/Fixtures/Builder/BarNodeDefinition.php b/src/Symfony/Component/Config/Tests/Fixtures/Builder/BarNodeDefinition.php index 47701c1b29eb8..0d46f3d2c8c01 100644 --- a/src/Symfony/Component/Config/Tests/Fixtures/Builder/BarNodeDefinition.php +++ b/src/Symfony/Component/Config/Tests/Fixtures/Builder/BarNodeDefinition.php @@ -12,10 +12,12 @@ namespace Symfony\Component\Config\Tests\Definition\Builder; use Symfony\Component\Config\Definition\Builder\NodeDefinition; +use Symfony\Component\Config\Tests\Fixtures\BarNode; class BarNodeDefinition extends NodeDefinition { protected function createNode() { + return new BarNode($this->name); } } diff --git a/src/Symfony/Component/Form/Tests/CompoundFormTest.php b/src/Symfony/Component/Form/Tests/CompoundFormTest.php index 3738a4c953c0c..b9b93e54c1637 100644 --- a/src/Symfony/Component/Form/Tests/CompoundFormTest.php +++ b/src/Symfony/Component/Form/Tests/CompoundFormTest.php @@ -299,6 +299,8 @@ public function testRemoveThrowsExceptionIfAlreadySubmitted() public function testRemoveIgnoresUnknownName() { $this->form->remove('notexisting'); + + $this->assertCount(0, $this->form); } public function testArrayAccess() diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php index 983397b09d624..3e36c7dd2936a 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php @@ -126,9 +126,9 @@ public function testChoiceLoaderOptionExpectsChoiceLoaderInterface() public function testChoiceListAndChoicesCanBeEmpty() { - $this->factory->create(static::TESTED_TYPE, null, array( + $this->assertInstanceOf('Symfony\Component\Form\FormInterface', $this->factory->create(static::TESTED_TYPE, null, array( 'choices_as_values' => true, - )); + ))); } public function testExpandedChoicesOptionsTurnIntoChildren() @@ -2251,10 +2251,10 @@ public function testAdjustFullNameForMultipleNonExpanded() // https://github.com/symfony/symfony/issues/3298 public function testInitializeWithEmptyChoices() { - $this->factory->createNamed('name', static::TESTED_TYPE, null, array( + $this->assertInstanceOf('Symfony\Component\Form\FormInterface', $this->factory->createNamed('name', static::TESTED_TYPE, null, array( 'choices' => array(), 'choices_as_values' => true, - )); + ))); } public function testInitializeWithDefaultObjectChoice() diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/CountryTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/CountryTypeTest.php index 3d8e86defb39f..7765f4706d399 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/CountryTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/CountryTypeTest.php @@ -43,11 +43,13 @@ public function testUnknownCountryIsNotIncluded() $choices = $this->factory->create(static::TESTED_TYPE, 'country') ->createView()->vars['choices']; + $countryCodes = array(); + foreach ($choices as $choice) { - if ('ZZ' === $choice->value) { - $this->fail('Should not contain choice "ZZ"'); - } + $countryCodes[] = $choice->value; } + + $this->assertNotContains('ZZ', $countryCodes); } public function testSubmitNull($expected = null, $norm = null, $view = null) diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTimeTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTimeTypeTest.php index dca17c3400223..9a80bdd87ba86 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTimeTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTimeTypeTest.php @@ -273,7 +273,7 @@ public function testInitializeWithDateTime() { // Throws an exception if "data_class" option is not explicitly set // to null in the type - $this->factory->create(static::TESTED_TYPE, new \DateTime()); + $this->assertInstanceOf('Symfony\Component\Form\FormInterface', $this->factory->create(static::TESTED_TYPE, new \DateTime())); } public function testSingleTextWidgetShouldUseTheRightInputType() diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php index d907c9c3d15e2..7fcb1f505d337 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php @@ -711,7 +711,7 @@ public function testInitializeWithDateTime() { // Throws an exception if "data_class" option is not explicitly set // to null in the type - $this->factory->create(static::TESTED_TYPE, new \DateTime()); + $this->assertInstanceOf('Symfony\Component\Form\FormInterface', $this->factory->create(static::TESTED_TYPE, new \DateTime())); } public function testSingleTextWidgetShouldUseTheRightInputType() diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/FormTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/FormTypeTest.php index 5f5d5def6937b..1ff4057d5f373 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/FormTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/FormTypeTest.php @@ -149,23 +149,23 @@ public function testPassMaxLengthBCToView() public function testDataClassMayBeNull() { - $this->factory->createBuilder(static::TESTED_TYPE, null, array( + $this->assertInstanceOf('Symfony\Component\Form\FormBuilderInterface', $this->factory->createBuilder(static::TESTED_TYPE, null, array( 'data_class' => null, - )); + ))); } public function testDataClassMayBeAbstractClass() { - $this->factory->createBuilder(static::TESTED_TYPE, null, array( + $this->assertInstanceOf('Symfony\Component\Form\FormBuilderInterface', $this->factory->createBuilder(static::TESTED_TYPE, null, array( 'data_class' => 'Symfony\Component\Form\Tests\Fixtures\AbstractAuthor', - )); + ))); } public function testDataClassMayBeInterface() { - $this->factory->createBuilder(static::TESTED_TYPE, null, array( + $this->assertInstanceOf('Symfony\Component\Form\FormBuilderInterface', $this->factory->createBuilder(static::TESTED_TYPE, null, array( 'data_class' => 'Symfony\Component\Form\Tests\Fixtures\AuthorInterface', - )); + ))); } /** @@ -652,7 +652,7 @@ public function testCanGetErrorsWhenButtonInForm() $form = $builder->getForm(); //This method should not throw a Fatal Error Exception. - $form->getErrorsAsString(); + $this->assertInternalType('string', $form->getErrorsAsString()); } public function testSubmitNull($expected = null, $norm = null, $view = null) diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimeTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimeTypeTest.php index 8537c96fe049f..48fd5964db611 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimeTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimeTypeTest.php @@ -488,7 +488,7 @@ public function testInitializeWithDateTime() { // Throws an exception if "data_class" option is not explicitly set // to null in the type - $this->factory->create(static::TESTED_TYPE, new \DateTime()); + $this->assertInstanceOf('Symfony\Component\Form\FormInterface', $this->factory->create(static::TESTED_TYPE, new \DateTime())); } public function testSingleTextWidgetShouldUseTheRightInputType() diff --git a/src/Symfony/Component/Form/Tests/Extension/DependencyInjection/DependencyInjectionExtensionTest.php b/src/Symfony/Component/Form/Tests/Extension/DependencyInjection/DependencyInjectionExtensionTest.php index 22f3f9d8e3589..f04d092e878dd 100644 --- a/src/Symfony/Component/Form/Tests/Extension/DependencyInjection/DependencyInjectionExtensionTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/DependencyInjection/DependencyInjectionExtensionTest.php @@ -46,16 +46,21 @@ public function testGetTypeExtensions() public function testThrowExceptionForInvalidExtendedType() { + $formTypeExtension = $this->createFormTypeExtensionMock('unmatched'); + $container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock(); $container->expects($this->any()) ->method('get') ->with('extension') - ->willReturn($this->createFormTypeExtensionMock('unmatched')); + ->willReturn($formTypeExtension); $extension = new DependencyInjectionExtension($container, array(), array('test' => array('extension')), array()); - $extension->getTypeExtensions('test'); + $extensions = $extension->getTypeExtensions('test'); + + $this->assertCount(1, $extensions); + $this->assertSame($formTypeExtension, $extensions[0]); } public function testGetTypeGuesser() diff --git a/src/Symfony/Component/Form/Tests/FormBuilderTest.php b/src/Symfony/Component/Form/Tests/FormBuilderTest.php index fae2b1623dbf8..4f0a813ccd8bb 100644 --- a/src/Symfony/Component/Form/Tests/FormBuilderTest.php +++ b/src/Symfony/Component/Form/Tests/FormBuilderTest.php @@ -161,6 +161,8 @@ public function testAddButton() { $this->builder->add(new ButtonBuilder('reset')); $this->builder->add(new SubmitButtonBuilder('submit')); + + $this->assertCount(2, $this->builder->all()); } public function testGetUnknown() diff --git a/src/Symfony/Component/Form/Tests/FormConfigTest.php b/src/Symfony/Component/Form/Tests/FormConfigTest.php index 21eabba871d38..bb922bf3d61ff 100644 --- a/src/Symfony/Component/Form/Tests/FormConfigTest.php +++ b/src/Symfony/Component/Form/Tests/FormConfigTest.php @@ -12,9 +12,7 @@ namespace Symfony\Component\Form\Tests; use PHPUnit\Framework\TestCase; -use Symfony\Component\Form\Exception\UnexpectedTypeException; use Symfony\Component\Form\FormConfigBuilder; -use Symfony\Component\Form\Exception\InvalidArgumentException; /** * @author Bernhard Schussek @@ -24,72 +22,65 @@ class FormConfigTest extends TestCase public function getHtml4Ids() { return array( - array('z0', true), - array('A0', true), - array('A9', true), - array('Z0', true), - array('#', false), - array('a#', false), - array('a$', false), - array('a%', false), - array('a ', false), - array("a\t", false), - array("a\n", false), - array('a-', true), - array('a_', true), - array('a:', true), + array('z0'), + array('A0'), + array('A9'), + array('Z0'), + array('#', 'Symfony\Component\Form\Exception\InvalidArgumentException'), + array('a#', 'Symfony\Component\Form\Exception\InvalidArgumentException'), + array('a$', 'Symfony\Component\Form\Exception\InvalidArgumentException'), + array('a%', 'Symfony\Component\Form\Exception\InvalidArgumentException'), + array('a ', 'Symfony\Component\Form\Exception\InvalidArgumentException'), + array("a\t", 'Symfony\Component\Form\Exception\InvalidArgumentException'), + array("a\n", 'Symfony\Component\Form\Exception\InvalidArgumentException'), + array('a-'), + array('a_'), + array('a:'), // Periods are allowed by the HTML4 spec, but disallowed by us // because they break the generated property paths - array('a.', false), + array('a.', 'Symfony\Component\Form\Exception\InvalidArgumentException'), // Contrary to the HTML4 spec, we allow names starting with a // number, otherwise naming fields by collection indices is not // possible. // For root forms, leading digits will be stripped from the // "id" attribute to produce valid HTML4. - array('0', true), - array('9', true), + array('0'), + array('9'), // Contrary to the HTML4 spec, we allow names starting with an // underscore, since this is already a widely used practice in // Symfony. // For root forms, leading underscores will be stripped from the // "id" attribute to produce valid HTML4. - array('_', true), + array('_'), // Integers are allowed - array(0, true), - array(123, true), + array(0), + array(123), // NULL is allowed - array(null, true), + array(null), // Other types are not - array(1.23, false), - array(5., false), - array(true, false), - array(new \stdClass(), false), + array(1.23, 'Symfony\Component\Form\Exception\UnexpectedTypeException'), + array(5., 'Symfony\Component\Form\Exception\UnexpectedTypeException'), + array(true, 'Symfony\Component\Form\Exception\UnexpectedTypeException'), + array(new \stdClass(), 'Symfony\Component\Form\Exception\UnexpectedTypeException'), ); } /** * @dataProvider getHtml4Ids */ - public function testNameAcceptsOnlyNamesValidAsIdsInHtml4($name, $accepted) + public function testNameAcceptsOnlyNamesValidAsIdsInHtml4($name, $expectedException = null) { $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface')->getMock(); - try { - new FormConfigBuilder($name, null, $dispatcher); - if (!$accepted) { - $this->fail(sprintf('The value "%s" should not be accepted', $name)); - } - } catch (UnexpectedTypeException $e) { - // if the value was not accepted, but should be, rethrow exception - if ($accepted) { - throw $e; - } - } catch (InvalidArgumentException $e) { - // if the value was not accepted, but should be, rethrow exception - if ($accepted) { - throw $e; - } + if (null !== $expectedException && method_exists($this, 'expectException')) { + $this->expectException($expectedException); + } elseif (null !== $expectedException) { + $this->setExpectedException($expectedException); } + + $formConfigBuilder = new FormConfigBuilder($name, null, $dispatcher); + + $this->assertSame((string) $name, $formConfigBuilder->getName()); } public function testGetRequestHandlerCreatesNativeRequestHandlerIfNotSet() @@ -109,27 +100,42 @@ public function testGetRequestHandlerReusesNativeRequestHandlerInstance() public function testSetMethodAllowsGet() { - $this->getConfigBuilder()->setMethod('GET'); + $formConfigBuilder = $this->getConfigBuilder(); + $formConfigBuilder->setMethod('GET'); + + self::assertSame('GET', $formConfigBuilder->getMethod()); } public function testSetMethodAllowsPost() { - $this->getConfigBuilder()->setMethod('POST'); + $formConfigBuilder = $this->getConfigBuilder(); + $formConfigBuilder->setMethod('POST'); + + self::assertSame('POST', $formConfigBuilder->getMethod()); } public function testSetMethodAllowsPut() { - $this->getConfigBuilder()->setMethod('PUT'); + $formConfigBuilder = $this->getConfigBuilder(); + $formConfigBuilder->setMethod('PUT'); + + self::assertSame('PUT', $formConfigBuilder->getMethod()); } public function testSetMethodAllowsDelete() { - $this->getConfigBuilder()->setMethod('DELETE'); + $formConfigBuilder = $this->getConfigBuilder(); + $formConfigBuilder->setMethod('DELETE'); + + self::assertSame('DELETE', $formConfigBuilder->getMethod()); } public function testSetMethodAllowsPatch() { - $this->getConfigBuilder()->setMethod('PATCH'); + $formConfigBuilder = $this->getConfigBuilder(); + $formConfigBuilder->setMethod('PATCH'); + + self::assertSame('PATCH', $formConfigBuilder->getMethod()); } /** diff --git a/src/Symfony/Component/Form/Tests/SimpleFormTest.php b/src/Symfony/Component/Form/Tests/SimpleFormTest.php index 6223d3b39f95c..9d745e3edf81d 100644 --- a/src/Symfony/Component/Form/Tests/SimpleFormTest.php +++ b/src/Symfony/Component/Form/Tests/SimpleFormTest.php @@ -918,12 +918,11 @@ public function testSetDataCannotInvokeItself() public function testSubmittingWrongDataIsIgnored() { - $test = $this; + $called = 0; $child = $this->getBuilder('child', $this->dispatcher); - $child->addEventListener(FormEvents::PRE_SUBMIT, function (FormEvent $event) use ($test) { - // child form doesn't receive the wrong data that is submitted on parent - $test->assertNull($event->getData()); + $child->addEventListener(FormEvents::PRE_SUBMIT, function () use (&$called) { + ++$called; }); $parent = $this->getBuilder('parent', new EventDispatcher()) @@ -933,6 +932,8 @@ public function testSubmittingWrongDataIsIgnored() ->getForm(); $parent->submit('not-an-array'); + + $this->assertSame(0, $called, 'PRE_SUBMIT event listeners are not called for wrong data'); } public function testHandleRequestForwardsToRequestHandler() @@ -1036,15 +1037,17 @@ public function testPostSubmitDataIsNullIfInheritData() public function testSubmitIsNeverFiredIfInheritData() { - $test = $this; + $called = 0; $form = $this->getBuilder() - ->addEventListener(FormEvents::SUBMIT, function (FormEvent $event) use ($test) { - $test->fail('The SUBMIT event should not be fired'); + ->addEventListener(FormEvents::SUBMIT, function () use (&$called) { + ++$called; }) ->setInheritData(true) ->getForm(); $form->submit('foo'); + + $this->assertSame(0, $called, 'The SUBMIT event is not fired when data are inherited from the parent form'); } public function testInitializeSetsDefaultData() diff --git a/src/Symfony/Component/Form/Tests/Util/OrderedHashMapTest.php b/src/Symfony/Component/Form/Tests/Util/OrderedHashMapTest.php index 4328919651efa..89735ea6180c6 100644 --- a/src/Symfony/Component/Form/Tests/Util/OrderedHashMapTest.php +++ b/src/Symfony/Component/Form/Tests/Util/OrderedHashMapTest.php @@ -114,8 +114,11 @@ public function testUnset() public function testUnsetNonExistingSucceeds() { $map = new OrderedHashMap(); + $map['second'] = 2; unset($map['first']); + + $this->assertSame(array('second' => 2), iterator_to_array($map)); } public function testEmptyIteration() diff --git a/src/Symfony/Component/HttpFoundation/Tests/IpUtilsTest.php b/src/Symfony/Component/HttpFoundation/Tests/IpUtilsTest.php index 61aa74861ddee..297ee3d8d3542 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/IpUtilsTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/IpUtilsTest.php @@ -17,14 +17,14 @@ class IpUtilsTest extends TestCase { /** - * @dataProvider testIpv4Provider + * @dataProvider getIpv4Data */ public function testIpv4($matches, $remoteAddr, $cidr) { $this->assertSame($matches, IpUtils::checkIp($remoteAddr, $cidr)); } - public function testIpv4Provider() + public function getIpv4Data() { return array( array(true, '192.168.1.1', '192.168.1.1'), @@ -43,7 +43,7 @@ public function testIpv4Provider() } /** - * @dataProvider testIpv6Provider + * @dataProvider getIpv6Data */ public function testIpv6($matches, $remoteAddr, $cidr) { @@ -54,7 +54,7 @@ public function testIpv6($matches, $remoteAddr, $cidr) $this->assertSame($matches, IpUtils::checkIp($remoteAddr, $cidr)); } - public function testIpv6Provider() + public function getIpv6Data() { return array( array(true, '2a01:198:603:0:396e:4789:8e99:890f', '2a01:198:603:0::/65'), diff --git a/src/Symfony/Component/HttpFoundation/Tests/RequestMatcherTest.php b/src/Symfony/Component/HttpFoundation/Tests/RequestMatcherTest.php index 6f864d4468fe7..b5d80048ff11e 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/RequestMatcherTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/RequestMatcherTest.php @@ -18,7 +18,7 @@ class RequestMatcherTest extends TestCase { /** - * @dataProvider testMethodFixtures + * @dataProvider getMethodData */ public function testMethod($requestMethod, $matcherMethod, $isMatch) { @@ -32,7 +32,7 @@ public function testMethod($requestMethod, $matcherMethod, $isMatch) $this->assertSame($isMatch, $matcher->matches($request)); } - public function testMethodFixtures() + public function getMethodData() { return array( array('get', 'get', true), @@ -64,7 +64,7 @@ public function testScheme() } /** - * @dataProvider testHostFixture + * @dataProvider getHostData */ public function testHost($pattern, $isMatch) { @@ -78,7 +78,7 @@ public function testHost($pattern, $isMatch) $this->assertSame($isMatch, $matcher->matches($request)); } - public function testHostFixture() + public function getHostData() { return array( array('.*\.example\.com', true), diff --git a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php index 2d8baa7142e12..6f9d76b4835e0 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php @@ -306,6 +306,10 @@ public function testGetFormatFromMimeType($format, $mimeTypes) $request->setFormat($format, $mimeTypes); foreach ($mimeTypes as $mime) { $this->assertEquals($format, $request->getFormat($mime)); + + if (null !== $format) { + $this->assertEquals($mimeTypes[0], $request->getMimeType($format)); + } } } @@ -315,17 +319,6 @@ public function testGetFormatFromMimeTypeWithParameters() $this->assertEquals('json', $request->getFormat('application/json; charset=utf-8')); } - /** - * @dataProvider getFormatToMimeTypeMapProvider - */ - public function testGetMimeTypeFromFormat($format, $mimeTypes) - { - if (null !== $format) { - $request = new Request(); - $this->assertEquals($mimeTypes[0], $request->getMimeType($format)); - } - } - public function testGetFormatWithCustomMimeType() { $request = new Request(); @@ -821,7 +814,7 @@ public function testGetSetMethod() } /** - * @dataProvider testGetClientIpsProvider + * @dataProvider getClientIpsProvider */ public function testGetClientIp($expected, $remoteAddr, $httpForwardedFor, $trustedProxies) { @@ -833,7 +826,7 @@ public function testGetClientIp($expected, $remoteAddr, $httpForwardedFor, $trus } /** - * @dataProvider testGetClientIpsProvider + * @dataProvider getClientIpsProvider */ public function testGetClientIps($expected, $remoteAddr, $httpForwardedFor, $trustedProxies) { @@ -845,7 +838,7 @@ public function testGetClientIps($expected, $remoteAddr, $httpForwardedFor, $tru } /** - * @dataProvider testGetClientIpsForwardedProvider + * @dataProvider getClientIpsForwardedProvider */ public function testGetClientIpsForwarded($expected, $remoteAddr, $httpForwarded, $trustedProxies) { @@ -856,7 +849,7 @@ public function testGetClientIpsForwarded($expected, $remoteAddr, $httpForwarded Request::setTrustedProxies(array()); } - public function testGetClientIpsForwardedProvider() + public function getClientIpsForwardedProvider() { // $expected $remoteAddr $httpForwarded $trustedProxies return array( @@ -869,7 +862,7 @@ public function testGetClientIpsForwardedProvider() ); } - public function testGetClientIpsProvider() + public function getClientIpsProvider() { // $expected $remoteAddr $httpForwardedFor $trustedProxies return array( @@ -926,7 +919,7 @@ public function testGetClientIpsProvider() /** * @expectedException \Symfony\Component\HttpFoundation\Exception\ConflictingHeadersException - * @dataProvider testGetClientIpsWithConflictingHeadersProvider + * @dataProvider getClientIpsWithConflictingHeadersProvider */ public function testGetClientIpsWithConflictingHeaders($httpForwarded, $httpXForwardedFor) { @@ -945,7 +938,7 @@ public function testGetClientIpsWithConflictingHeaders($httpForwarded, $httpXFor $request->getClientIps(); } - public function testGetClientIpsWithConflictingHeadersProvider() + public function getClientIpsWithConflictingHeadersProvider() { // $httpForwarded $httpXForwardedFor return array( @@ -958,9 +951,9 @@ public function testGetClientIpsWithConflictingHeadersProvider() } /** - * @dataProvider testGetClientIpsWithAgreeingHeadersProvider + * @dataProvider getClientIpsWithAgreeingHeadersProvider */ - public function testGetClientIpsWithAgreeingHeaders($httpForwarded, $httpXForwardedFor) + public function testGetClientIpsWithAgreeingHeaders($httpForwarded, $httpXForwardedFor, $expectedIps) { $request = new Request(); @@ -974,21 +967,23 @@ public function testGetClientIpsWithAgreeingHeaders($httpForwarded, $httpXForwar $request->initialize(array(), array(), array(), array(), array(), $server); - $request->getClientIps(); + $clientIps = $request->getClientIps(); Request::setTrustedProxies(array()); + + $this->assertSame($expectedIps, $clientIps); } - public function testGetClientIpsWithAgreeingHeadersProvider() + public function getClientIpsWithAgreeingHeadersProvider() { // $httpForwarded $httpXForwardedFor return array( - array('for="192.0.2.60"', '192.0.2.60'), - array('for=192.0.2.60, for=87.65.43.21', '192.0.2.60,87.65.43.21'), - array('for="[::face]", for=192.0.2.60', '::face,192.0.2.60'), - array('for="192.0.2.60:80"', '192.0.2.60'), - array('for=192.0.2.60;proto=http;by=203.0.113.43', '192.0.2.60'), - array('for="[2001:db8:cafe::17]:4711"', '2001:db8:cafe::17'), + array('for="192.0.2.60"', '192.0.2.60', array('192.0.2.60')), + array('for=192.0.2.60, for=87.65.43.21', '192.0.2.60,87.65.43.21', array('87.65.43.21', '192.0.2.60')), + array('for="[::face]", for=192.0.2.60', '::face,192.0.2.60', array('192.0.2.60', '::face')), + array('for="192.0.2.60:80"', '192.0.2.60', array('192.0.2.60')), + array('for=192.0.2.60;proto=http;by=203.0.113.43', '192.0.2.60', array('192.0.2.60')), + array('for="[2001:db8:cafe::17]:4711"', '2001:db8:cafe::17', array('2001:db8:cafe::17')), ); } diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php index 4d5d337a3c011..fa93507a41aaf 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php @@ -177,6 +177,8 @@ public function testSave() { $this->session->start(); $this->session->save(); + + $this->assertFalse($this->session->isStarted()); } public function testGetId() diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MetadataBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MetadataBagTest.php index 1f55a2d5c440d..159e62114e1a3 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MetadataBagTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MetadataBagTest.php @@ -103,6 +103,9 @@ public function testGetLastUsed() public function testClear() { $this->bag->clear(); + + // the clear method has no side effects, we just want to ensure it doesn't trigger any exceptions + $this->addToAssertionCount(1); } public function testSkipLastUsedUpdate() diff --git a/src/Symfony/Component/HttpFoundation/Tests/StreamedResponseTest.php b/src/Symfony/Component/HttpFoundation/Tests/StreamedResponseTest.php index 844274b1e7e21..5874145348eab 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/StreamedResponseTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/StreamedResponseTest.php @@ -51,10 +51,12 @@ public function testPrepareWith10Protocol() public function testPrepareWithHeadRequest() { - $response = new StreamedResponse(function () { echo 'foo'; }); + $response = new StreamedResponse(function () { echo 'foo'; }, 200, array('Content-Length' => '123')); $request = Request::create('/', 'HEAD'); $response->prepare($request); + + $this->assertSame('123', $response->headers->get('Content-Length')); } public function testPrepareWithCacheHeaders() diff --git a/src/Symfony/Component/Security/Acl/Tests/Dbal/MutableAclProviderTest.php b/src/Symfony/Component/Security/Acl/Tests/Dbal/MutableAclProviderTest.php index e7de0b54875e2..f119168221959 100644 --- a/src/Symfony/Component/Security/Acl/Tests/Dbal/MutableAclProviderTest.php +++ b/src/Symfony/Component/Security/Acl/Tests/Dbal/MutableAclProviderTest.php @@ -19,8 +19,6 @@ use Symfony\Component\Security\Acl\Domain\Entry; use Symfony\Component\Security\Acl\Domain\UserSecurityIdentity; use Symfony\Component\Security\Acl\Domain\Acl; -use Symfony\Component\Security\Acl\Exception\AclNotFoundException; -use Symfony\Component\Security\Acl\Exception\ConcurrentModificationException; use Symfony\Component\Security\Acl\Dbal\AclProvider; use Symfony\Component\Security\Acl\Domain\PermissionGrantingStrategy; use Symfony\Component\Security\Acl\Dbal\MutableAclProvider; @@ -79,23 +77,25 @@ public function testCreateAcl() $this->assertTrue($acl->getObjectIdentity()->equals($oid)); } + /** + * @expectedException \Symfony\Component\Security\Acl\Exception\AclNotFoundException + */ public function testDeleteAcl() { $provider = $this->getProvider(); $oid = new ObjectIdentity(1, 'Foo'); - $acl = $provider->createAcl($oid); + $provider->createAcl($oid); $provider->deleteAcl($oid); $loadedAcls = $this->getField($provider, 'loadedAcls'); $this->assertCount(0, $loadedAcls['Foo']); - try { - $provider->findAcl($oid); - $this->fail('ACL has not been properly deleted.'); - } catch (AclNotFoundException $e) { - } + $provider->findAcl($oid); } + /** + * @expectedException \Symfony\Component\Security\Acl\Exception\AclNotFoundException + */ public function testDeleteAclDeletesChildren() { $provider = $this->getProvider(); @@ -105,11 +105,7 @@ public function testDeleteAclDeletesChildren() $provider->updateAcl($acl); $provider->deleteAcl($parentAcl->getObjectIdentity()); - try { - $provider->findAcl(new ObjectIdentity(1, 'Foo')); - $this->fail('Child-ACLs have not been deleted.'); - } catch (AclNotFoundException $e) { - } + $provider->findAcl(new ObjectIdentity(1, 'Foo')); } public function testFindAclsAddsPropertyListener() @@ -273,6 +269,9 @@ public function testUpdateDoesNothingWhenThereAreNoChanges() $provider->updateAcl($acl); } + /** + * @expectedException \Symfony\Component\Security\Acl\Exception\ConcurrentModificationException + */ public function testUpdateAclThrowsExceptionOnConcurrentModificationOfSharedProperties() { $provider = $this->getProvider(); @@ -291,11 +290,7 @@ public function testUpdateAclThrowsExceptionOnConcurrentModificationOfSharedProp $acl1->insertClassAce($sid, 3); $acl2->insertClassAce($sid, 5); - try { - $provider->updateAcl($acl1); - $this->fail('Provider failed to detect a concurrent modification.'); - } catch (ConcurrentModificationException $e) { - } + $provider->updateAcl($acl1); } public function testUpdateAcl() @@ -366,7 +361,7 @@ public function testUpdateAclUpdatesChildAclsCorrectly() $this->assertEquals($newParentParentAcl->getId(), $reloadedAcl->getParentAcl()->getParentAcl()->getId()); } - public function testUpdateAclInsertingMultipleObjectFieldAcesThrowsDBConstraintViolations() + public function testUpdateAclInsertingMultipleObjectFieldAcesDoesNotThrowDBConstraintViolations() { $provider = $this->getProvider(); $oid = new ObjectIdentity(1, 'Foo'); @@ -386,9 +381,11 @@ public function testUpdateAclInsertingMultipleObjectFieldAcesThrowsDBConstraintV $acl = $provider->findAcl($oid); $acl->insertObjectFieldAce($fieldName, $sid3, 4); $provider->updateAcl($acl); + + $this->assertCount(3, $provider->findAcl($oid)->getObjectFieldAces($fieldName)); } - public function testUpdateAclDeletingObjectFieldAcesThrowsDBConstraintViolations() + public function testUpdateAclDeletingObjectFieldAcesDoesNotThrowDBConstraintViolations() { $provider = $this->getProvider(); $oid = new ObjectIdentity(1, 'Foo'); @@ -412,6 +409,8 @@ public function testUpdateAclDeletingObjectFieldAcesThrowsDBConstraintViolations $acl = $provider->findAcl($oid); $acl->insertObjectFieldAce($fieldName, $sid3, 4); $provider->updateAcl($acl); + + $this->assertCount(2, $provider->findAcl($oid)->getObjectFieldAces($fieldName)); } public function testUpdateUserSecurityIdentity() diff --git a/src/Symfony/Component/Security/Acl/Tests/Domain/PermissionGrantingStrategyTest.php b/src/Symfony/Component/Security/Acl/Tests/Domain/PermissionGrantingStrategyTest.php index f77262654f12b..abb89eceac9a0 100644 --- a/src/Symfony/Component/Security/Acl/Tests/Domain/PermissionGrantingStrategyTest.php +++ b/src/Symfony/Component/Security/Acl/Tests/Domain/PermissionGrantingStrategyTest.php @@ -17,7 +17,6 @@ use Symfony\Component\Security\Acl\Domain\Acl; use Symfony\Component\Security\Acl\Domain\UserSecurityIdentity; use Symfony\Component\Security\Acl\Domain\PermissionGrantingStrategy; -use Symfony\Component\Security\Acl\Exception\NoAceFoundException; class PermissionGrantingStrategyTest extends TestCase { @@ -152,11 +151,13 @@ public function testIsGrantedStrategies($maskStrategy, $aceMask, $requiredMask, $acl->insertObjectAce($sid, $aceMask, 0, true, $maskStrategy); if (false === $result) { - try { - $strategy->isGranted($acl, array($requiredMask), array($sid)); - $this->fail('The ACE is not supposed to match.'); - } catch (NoAceFoundException $e) { + if (method_exists($this, 'expectException')) { + $this->expectException('Symfony\Component\Security\Acl\Exception\NoAceFoundException'); + } else { + $this->setExpectedException('Symfony\Component\Security\Acl\Exception\NoAceFoundException'); } + + $strategy->isGranted($acl, array($requiredMask), array($sid)); } else { $this->assertTrue($strategy->isGranted($acl, array($requiredMask), array($sid))); } diff --git a/src/Symfony/Component/Security/Core/Tests/Encoder/BCryptPasswordEncoderTest.php b/src/Symfony/Component/Security/Core/Tests/Encoder/BCryptPasswordEncoderTest.php index 10c8da692a6fd..b6b6ab8c8015d 100644 --- a/src/Symfony/Component/Security/Core/Tests/Encoder/BCryptPasswordEncoderTest.php +++ b/src/Symfony/Component/Security/Core/Tests/Encoder/BCryptPasswordEncoderTest.php @@ -39,11 +39,20 @@ public function testCostAboveRange() new BCryptPasswordEncoder(32); } - public function testCostInRange() + /** + * @dataProvider validRangeData + */ + public function testCostInRange($cost) + { + $this->assertInstanceOf('Symfony\Component\Security\Core\Encoder\BCryptPasswordEncoder', new BCryptPasswordEncoder($cost)); + } + + public function validRangeData() { - for ($cost = 4; $cost <= 31; ++$cost) { - new BCryptPasswordEncoder($cost); - } + $costs = range(4, 31); + array_walk($costs, function (&$cost) { $cost = array($cost); }); + + return $costs; } public function testResultLength() diff --git a/src/Symfony/Component/Security/Core/Tests/LegacySecurityContextTest.php b/src/Symfony/Component/Security/Core/Tests/LegacySecurityContextTest.php index 3661c7be95609..3c842aae76cef 100644 --- a/src/Symfony/Component/Security/Core/Tests/LegacySecurityContextTest.php +++ b/src/Symfony/Component/Security/Core/Tests/LegacySecurityContextTest.php @@ -86,7 +86,8 @@ public function testOldConstructorSignature() { $authenticationManager = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface')->getMock(); $accessDecisionManager = $this->getMockBuilder('Symfony\Component\Security\Core\Authorization\AccessDecisionManagerInterface')->getMock(); - new SecurityContext($authenticationManager, $accessDecisionManager); + + $this->assertInstanceOf('Symfony\Component\Security\Core\SecurityContext', new SecurityContext($authenticationManager, $accessDecisionManager)); } /** diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/DigestDataTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/DigestDataTest.php index 2238a74188853..7317e2f83c7cc 100644 --- a/src/Symfony/Component/Security/Http/Tests/Firewall/DigestDataTest.php +++ b/src/Symfony/Component/Security/Http/Tests/Firewall/DigestDataTest.php @@ -100,6 +100,9 @@ public function testGetUsernameWithEscape() $this->assertEquals('"u\\ser"', $digestAuth->getUsername()); } + /** + * @group time-sensitive + */ public function testValidateAndDecode() { $time = microtime(true); @@ -112,11 +115,11 @@ public function testValidateAndDecode() 'response="b52938fc9e6d7c01be7702ece9031b42"' ); - try { - $digestAuth->validateAndDecode($key, 'Welcome, robot!'); - } catch (\Exception $e) { - $this->fail(sprintf('testValidateAndDecode fail with message: %s', $e->getMessage())); - } + $digestAuth->validateAndDecode($key, 'Welcome, robot!'); + + sleep(1); + + $this->assertTrue($digestAuth->isNonceExpired()); } public function testCalculateServerDigest() From 22425b26923050bf4d66ee9db8caed9b1cf4f007 Mon Sep 17 00:00:00 2001 From: Abdellatif Ait boudad Date: Mon, 3 Apr 2017 16:48:48 +0100 Subject: [PATCH 03/51] [Translation] avoid creating cache files for fallback locales. --- .../Translation/Tests/TranslatorCacheTest.php | 11 +++++++++++ src/Symfony/Component/Translation/Translator.php | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Translation/Tests/TranslatorCacheTest.php b/src/Symfony/Component/Translation/Tests/TranslatorCacheTest.php index ea272b9eae1e5..9818caa803ef2 100644 --- a/src/Symfony/Component/Translation/Tests/TranslatorCacheTest.php +++ b/src/Symfony/Component/Translation/Tests/TranslatorCacheTest.php @@ -149,6 +149,17 @@ public function testDifferentTranslatorsForSameLocaleDoNotOverwriteEachOthersCac $this->assertEquals('OK', $translator->trans($msgid), '-> the cache was overwritten by another translator instance in '.($debug ? 'debug' : 'production')); } + public function testGeneratedCacheFilesAreOnlyBelongRequestedLocales() + { + $translator = new Translator('a', null, $this->tmpDir); + $translator->setFallbackLocales(array('b')); + $translator->trans('bar'); + + $cachedFiles = glob($this->tmpDir.'/*.php'); + + $this->assertCount(1, $cachedFiles); + } + public function testDifferentCacheFilesAreUsedForDifferentSetsOfFallbackLocales() { /* diff --git a/src/Symfony/Component/Translation/Translator.php b/src/Symfony/Component/Translation/Translator.php index ed80a5e49f0fd..816cfd28f9f2a 100644 --- a/src/Symfony/Component/Translation/Translator.php +++ b/src/Symfony/Component/Translation/Translator.php @@ -420,7 +420,7 @@ private function loadFallbackCatalogues($locale) foreach ($this->computeFallbackLocales($locale) as $fallback) { if (!isset($this->catalogues[$fallback])) { - $this->loadCatalogue($fallback); + $this->initializeCatalogue($fallback); } $fallbackCatalogue = new MessageCatalogue($fallback, $this->catalogues[$fallback]->all()); From f2ef1eecef9d137c999fe09bf6b3a083cbc609b6 Mon Sep 17 00:00:00 2001 From: Guilhem Niot Date: Tue, 4 Apr 2017 20:13:57 +0200 Subject: [PATCH 04/51] [DI] Fix the xml schema --- .../Loader/schema/dic/services/services-1.0.xsd | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/Symfony/Component/DependencyInjection/Loader/schema/dic/services/services-1.0.xsd b/src/Symfony/Component/DependencyInjection/Loader/schema/dic/services/services-1.0.xsd index 7c28fd8de3b32..fedc54d28097b 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/schema/dic/services/services-1.0.xsd +++ b/src/Symfony/Component/DependencyInjection/Loader/schema/dic/services/services-1.0.xsd @@ -140,8 +140,8 @@ - - + + @@ -153,8 +153,8 @@ - - + + @@ -165,10 +165,9 @@ - - - - + + + From 4951d3c96214a0cb80eeb868ec8e49cce954f7d3 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 4 Apr 2017 20:32:29 +0200 Subject: [PATCH 05/51] Dont call sprintf() when no placeholders are used --- .../FrameworkBundle/Command/ContainerDebugCommand.php | 4 ++-- src/Symfony/Component/DependencyInjection/Definition.php | 2 +- .../Component/DependencyInjection/Dumper/YamlDumper.php | 6 +++--- src/Symfony/Component/HttpFoundation/ParameterBag.php | 2 +- src/Symfony/Component/Validator/Validator.php | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php index edfa6d9cc94d5..dd85c2456abc7 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php @@ -167,11 +167,11 @@ protected function getContainerBuilder() } if (!$this->getApplication()->getKernel()->isDebug()) { - throw new \LogicException(sprintf('Debug information about the container is only available in debug mode.')); + throw new \LogicException('Debug information about the container is only available in debug mode.'); } if (!is_file($cachedFile = $this->getContainer()->getParameter('debug.container.dump'))) { - throw new \LogicException(sprintf('Debug information about the container could not be found. Please clear the cache and try again.')); + throw new \LogicException('Debug information about the container could not be found. Please clear the cache and try again.'); } $container = new ContainerBuilder(); diff --git a/src/Symfony/Component/DependencyInjection/Definition.php b/src/Symfony/Component/DependencyInjection/Definition.php index 49e4e1b0e29c4..aa76c96805a86 100644 --- a/src/Symfony/Component/DependencyInjection/Definition.php +++ b/src/Symfony/Component/DependencyInjection/Definition.php @@ -373,7 +373,7 @@ public function setMethodCalls(array $calls = array()) public function addMethodCall($method, array $arguments = array()) { if (empty($method)) { - throw new InvalidArgumentException(sprintf('Method name cannot be empty.')); + throw new InvalidArgumentException('Method name cannot be empty.'); } $this->calls[] = array($method, $arguments); diff --git a/src/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php index 1fa08e2b32912..810e7539fe1bd 100644 --- a/src/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php +++ b/src/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php @@ -93,11 +93,11 @@ private function addService($id, $definition) } if ($definition->isSynthetic()) { - $code .= sprintf(" synthetic: true\n"); + $code .= " synthetic: true\n"; } if ($definition->isSynchronized(false)) { - $code .= sprintf(" synchronized: true\n"); + $code .= " synchronized: true\n"; } if ($definition->getFactoryClass(false)) { @@ -105,7 +105,7 @@ private function addService($id, $definition) } if ($definition->isLazy()) { - $code .= sprintf(" lazy: true\n"); + $code .= " lazy: true\n"; } if ($definition->getFactoryMethod(false)) { diff --git a/src/Symfony/Component/HttpFoundation/ParameterBag.php b/src/Symfony/Component/HttpFoundation/ParameterBag.php index 4d082a8d2f962..3436ee9337486 100644 --- a/src/Symfony/Component/HttpFoundation/ParameterBag.php +++ b/src/Symfony/Component/HttpFoundation/ParameterBag.php @@ -129,7 +129,7 @@ public function get($path, $default = null, $deep = false) } if (null !== $currentKey) { - throw new \InvalidArgumentException(sprintf('Malformed path. Path must end with "]".')); + throw new \InvalidArgumentException('Malformed path. Path must end with "]".'); } return $value; diff --git a/src/Symfony/Component/Validator/Validator.php b/src/Symfony/Component/Validator/Validator.php index 4da27e7b375a0..feaec0d400382 100644 --- a/src/Symfony/Component/Validator/Validator.php +++ b/src/Symfony/Component/Validator/Validator.php @@ -151,7 +151,7 @@ public function validatePropertyValue($containingValue, $property, $value, $grou ? '"'.$containingValue.'"' : 'the value of type '.gettype($containingValue); - throw new ValidatorException(sprintf('The metadata for '.$valueAsString.' does not support properties.')); + throw new ValidatorException(sprintf('The metadata for %s does not support properties.', $valueAsString)); } // If $containingValue is passed as class name, take $value as root From a03dbd2cca16550cc54a8a31c3fb9b1ded938bd3 Mon Sep 17 00:00:00 2001 From: Douglas Reith Date: Wed, 5 Apr 2017 12:36:22 +0000 Subject: [PATCH 06/51] Fixes #22264 - add support for Chrome headless, see also Seldaek/monolog#966 --- src/Symfony/Bridge/Monolog/Handler/ChromePhpHandler.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Bridge/Monolog/Handler/ChromePhpHandler.php b/src/Symfony/Bridge/Monolog/Handler/ChromePhpHandler.php index 2636bc3b8980e..a60a4ec479042 100644 --- a/src/Symfony/Bridge/Monolog/Handler/ChromePhpHandler.php +++ b/src/Symfony/Bridge/Monolog/Handler/ChromePhpHandler.php @@ -41,7 +41,7 @@ public function onKernelResponse(FilterResponseEvent $event) return; } - if (!preg_match('{\b(?:Chrome/\d+(?:\.\d+)*|Firefox/(?:4[3-9]|[5-9]\d|\d{3,})(?:\.\d)*)\b}', $event->getRequest()->headers->get('User-Agent'))) { + if (!preg_match('{\b(?:Chrome/\d+(?:\.\d+)*|HeadlessChrome|Firefox/(?:4[3-9]|[5-9]\d|\d{3,})(?:\.\d)*)\b}', $event->getRequest()->headers->get('User-Agent'))) { $this->sendHeaders = false; $this->headers = array(); From 6dd023f255ae2a6924e6187193267f03ca231c73 Mon Sep 17 00:00:00 2001 From: apetitpa Date: Wed, 22 Mar 2017 15:02:58 +0100 Subject: [PATCH 07/51] [Validator] Allow checkMX() to return false when $host is empty | Q | A | | --- | --- | | Branch? | master | | Bug fix? | yes | | New feature? | no | | BC breaks? | no | | Deprecations? | no | | Tests pass? | yes | | Fixed tickets | #22106 | | License | MIT | | Doc PR | n/a | --- .../Component/Validator/Constraints/EmailValidator.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Symfony/Component/Validator/Constraints/EmailValidator.php b/src/Symfony/Component/Validator/Constraints/EmailValidator.php index 6ae25e016d921..d6b6a9021cebe 100644 --- a/src/Symfony/Component/Validator/Constraints/EmailValidator.php +++ b/src/Symfony/Component/Validator/Constraints/EmailValidator.php @@ -138,6 +138,10 @@ public function validate($value, Constraint $constraint) */ private function checkMX($host) { + if (null === $host || '' === $host) { + return false; + } + return checkdnsrr($host, 'MX'); } From 6b0702e52a730062735c3f915f22caffbf25f677 Mon Sep 17 00:00:00 2001 From: apetitpa Date: Thu, 23 Mar 2017 11:01:22 +0100 Subject: [PATCH 08/51] Add empty check on host in other methods + add unit tests Add empty on host in other methods where checkdnsrr is called and add unit tests to prevent future regressions --- .../Component/Validator/Constraints/EmailValidator.php | 6 +++++- .../Component/Validator/Constraints/UrlValidator.php | 2 +- .../Validator/Tests/Constraints/EmailValidatorTest.php | 6 ++++++ .../Validator/Tests/Constraints/UrlValidatorTest.php | 1 + 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Validator/Constraints/EmailValidator.php b/src/Symfony/Component/Validator/Constraints/EmailValidator.php index d6b6a9021cebe..cf334e5e51183 100644 --- a/src/Symfony/Component/Validator/Constraints/EmailValidator.php +++ b/src/Symfony/Component/Validator/Constraints/EmailValidator.php @@ -138,7 +138,7 @@ public function validate($value, Constraint $constraint) */ private function checkMX($host) { - if (null === $host || '' === $host) { + if ('' === $host) { return false; } @@ -154,6 +154,10 @@ private function checkMX($host) */ private function checkHost($host) { + if ('' === $host) { + return false; + } + return $this->checkMX($host) || (checkdnsrr($host, 'A') || checkdnsrr($host, 'AAAA')); } } diff --git a/src/Symfony/Component/Validator/Constraints/UrlValidator.php b/src/Symfony/Component/Validator/Constraints/UrlValidator.php index db7244f40ce7b..7e3a074e6c0e1 100644 --- a/src/Symfony/Component/Validator/Constraints/UrlValidator.php +++ b/src/Symfony/Component/Validator/Constraints/UrlValidator.php @@ -80,7 +80,7 @@ public function validate($value, Constraint $constraint) if ($constraint->checkDNS) { $host = parse_url($value, PHP_URL_HOST); - if (!checkdnsrr($host, 'ANY')) { + if ('' === $host || !checkdnsrr($host, 'ANY')) { if ($this->context instanceof ExecutionContextInterface) { $this->context->buildViolation($constraint->dnsMessage) ->setParameter('{{ value }}', $this->formatValue($host)) diff --git a/src/Symfony/Component/Validator/Tests/Constraints/EmailValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/EmailValidatorTest.php index cfa0e99c92325..f623129867cb1 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/EmailValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/EmailValidatorTest.php @@ -159,4 +159,10 @@ public function testHostnameIsProperlyParsed() $this->assertNoViolation(); } + + public function testEmptyHostReturnsFalse() + { + $this->assertFalse($this->validator->checkMX('')); + $this->assertFalse($this->validator->checkHost('')); + } } diff --git a/src/Symfony/Component/Validator/Tests/Constraints/UrlValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/UrlValidatorTest.php index 39f1708cf18ad..34ef99e018b04 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/UrlValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/UrlValidatorTest.php @@ -171,6 +171,7 @@ public function getInvalidUrls() array('http://example.com/exploit.html?'), array('http://example.com/exploit.html?hel lo'), array('http://example.com/exploit.html?not_a%hex'), + array('http:/.com'), ); } From 197d19f34cc700a4a890bbfd565d387d4bc570d4 Mon Sep 17 00:00:00 2001 From: apetitpa Date: Thu, 23 Mar 2017 11:43:53 +0100 Subject: [PATCH 09/51] Remove malformed EmailValidatorTest + Update UrlValidator test Remove malformed EmailValidatorTest + Update UrlValidator test --- .../Validator/Tests/Constraints/EmailValidatorTest.php | 6 ------ .../Validator/Tests/Constraints/UrlValidatorTest.php | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/src/Symfony/Component/Validator/Tests/Constraints/EmailValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/EmailValidatorTest.php index f623129867cb1..cfa0e99c92325 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/EmailValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/EmailValidatorTest.php @@ -159,10 +159,4 @@ public function testHostnameIsProperlyParsed() $this->assertNoViolation(); } - - public function testEmptyHostReturnsFalse() - { - $this->assertFalse($this->validator->checkMX('')); - $this->assertFalse($this->validator->checkHost('')); - } } diff --git a/src/Symfony/Component/Validator/Tests/Constraints/UrlValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/UrlValidatorTest.php index 34ef99e018b04..a581c9e08246a 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/UrlValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/UrlValidatorTest.php @@ -171,7 +171,7 @@ public function getInvalidUrls() array('http://example.com/exploit.html?'), array('http://example.com/exploit.html?hel lo'), array('http://example.com/exploit.html?not_a%hex'), - array('http:/.com'), + array('http://'), ); } From 60392fdd4357275fc6cf9cb229a903a8750ffd97 Mon Sep 17 00:00:00 2001 From: apetitpa Date: Thu, 23 Mar 2017 12:37:06 +0100 Subject: [PATCH 10/51] fix coding standard to comply with fabbot --- .../Component/Validator/Constraints/EmailValidator.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Validator/Constraints/EmailValidator.php b/src/Symfony/Component/Validator/Constraints/EmailValidator.php index cf334e5e51183..a6caa4b4a69a3 100644 --- a/src/Symfony/Component/Validator/Constraints/EmailValidator.php +++ b/src/Symfony/Component/Validator/Constraints/EmailValidator.php @@ -141,7 +141,7 @@ private function checkMX($host) if ('' === $host) { return false; } - + return checkdnsrr($host, 'MX'); } @@ -157,7 +157,7 @@ private function checkHost($host) if ('' === $host) { return false; } - + return $this->checkMX($host) || (checkdnsrr($host, 'A') || checkdnsrr($host, 'AAAA')); } } From a090ef855a2ef4d0badff7e13a1a9b2af729f53d Mon Sep 17 00:00:00 2001 From: apetitpa Date: Thu, 23 Mar 2017 12:49:26 +0100 Subject: [PATCH 11/51] Use LF line separator --- src/Symfony/Component/Validator/Constraints/EmailValidator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Validator/Constraints/EmailValidator.php b/src/Symfony/Component/Validator/Constraints/EmailValidator.php index a6caa4b4a69a3..3eee66fcd8cf7 100644 --- a/src/Symfony/Component/Validator/Constraints/EmailValidator.php +++ b/src/Symfony/Component/Validator/Constraints/EmailValidator.php @@ -141,7 +141,7 @@ private function checkMX($host) if ('' === $host) { return false; } - + return checkdnsrr($host, 'MX'); } From 4fcb24bacb8caa1cfa4fe74a7c25a72b9a6e5a71 Mon Sep 17 00:00:00 2001 From: apetitpa Date: Thu, 23 Mar 2017 13:36:20 +0100 Subject: [PATCH 12/51] Move empty condition in return statement --- .../Validator/Constraints/EmailValidator.php | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/Symfony/Component/Validator/Constraints/EmailValidator.php b/src/Symfony/Component/Validator/Constraints/EmailValidator.php index 3eee66fcd8cf7..cd635eb136446 100644 --- a/src/Symfony/Component/Validator/Constraints/EmailValidator.php +++ b/src/Symfony/Component/Validator/Constraints/EmailValidator.php @@ -138,11 +138,7 @@ public function validate($value, Constraint $constraint) */ private function checkMX($host) { - if ('' === $host) { - return false; - } - - return checkdnsrr($host, 'MX'); + return ('' !== $host) && checkdnsrr($host, 'MX'); } /** @@ -154,10 +150,6 @@ private function checkMX($host) */ private function checkHost($host) { - if ('' === $host) { - return false; - } - - return $this->checkMX($host) || (checkdnsrr($host, 'A') || checkdnsrr($host, 'AAAA')); + return ('' !== $host) && ($this->checkMX($host) || (checkdnsrr($host, 'A') || checkdnsrr($host, 'AAAA'))); } } From 9753a2773e9b8b00c180b0cc7aeb04609ab11d2f Mon Sep 17 00:00:00 2001 From: apetitpa Date: Thu, 23 Mar 2017 14:11:06 +0100 Subject: [PATCH 13/51] Add a test case to prevent future regressions --- .../Component/Validator/Tests/Constraints/EmailValidatorTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Symfony/Component/Validator/Tests/Constraints/EmailValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/EmailValidatorTest.php index cfa0e99c92325..cadd2b97040db 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/EmailValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/EmailValidatorTest.php @@ -96,6 +96,7 @@ public function getInvalidEmails() array('example@'), array('example@localhost'), array('foo@example.com bar'), + array('foo@bar.fr@'), ); } From 6071ff6c8fbca770312fc934dfc092656ac47212 Mon Sep 17 00:00:00 2001 From: apetitpa Date: Thu, 23 Mar 2017 14:51:52 +0100 Subject: [PATCH 14/51] Remove unnecessary parentheses --- .../Component/Validator/Constraints/EmailValidator.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Validator/Constraints/EmailValidator.php b/src/Symfony/Component/Validator/Constraints/EmailValidator.php index cd635eb136446..ce42219e26024 100644 --- a/src/Symfony/Component/Validator/Constraints/EmailValidator.php +++ b/src/Symfony/Component/Validator/Constraints/EmailValidator.php @@ -138,7 +138,7 @@ public function validate($value, Constraint $constraint) */ private function checkMX($host) { - return ('' !== $host) && checkdnsrr($host, 'MX'); + return '' !== $host && checkdnsrr($host, 'MX'); } /** @@ -150,6 +150,6 @@ private function checkMX($host) */ private function checkHost($host) { - return ('' !== $host) && ($this->checkMX($host) || (checkdnsrr($host, 'A') || checkdnsrr($host, 'AAAA'))); + return '' !== $host && ($this->checkMX($host) || (checkdnsrr($host, 'A') || checkdnsrr($host, 'AAAA'))); } } From 91b665c12ae6e00de8b74cf666eff24fc26d54cf Mon Sep 17 00:00:00 2001 From: apetitpa Date: Fri, 24 Mar 2017 16:26:16 +0100 Subject: [PATCH 15/51] Switch to `is_string` native method --- src/Symfony/Component/Validator/Constraints/UrlValidator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Validator/Constraints/UrlValidator.php b/src/Symfony/Component/Validator/Constraints/UrlValidator.php index 7e3a074e6c0e1..a12dc14979b47 100644 --- a/src/Symfony/Component/Validator/Constraints/UrlValidator.php +++ b/src/Symfony/Component/Validator/Constraints/UrlValidator.php @@ -80,7 +80,7 @@ public function validate($value, Constraint $constraint) if ($constraint->checkDNS) { $host = parse_url($value, PHP_URL_HOST); - if ('' === $host || !checkdnsrr($host, 'ANY')) { + if (!is_string($host) || !checkdnsrr($host, 'ANY')) { if ($this->context instanceof ExecutionContextInterface) { $this->context->buildViolation($constraint->dnsMessage) ->setParameter('{{ value }}', $this->formatValue($host)) From f390f29173dbbca90a62b61083039d5a03a6bb66 Mon Sep 17 00:00:00 2001 From: apetitpa Date: Fri, 24 Mar 2017 16:26:34 +0100 Subject: [PATCH 16/51] remove non relevant test case --- .../Component/Validator/Tests/Constraints/EmailValidatorTest.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Symfony/Component/Validator/Tests/Constraints/EmailValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/EmailValidatorTest.php index cadd2b97040db..cfa0e99c92325 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/EmailValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/EmailValidatorTest.php @@ -96,7 +96,6 @@ public function getInvalidEmails() array('example@'), array('example@localhost'), array('foo@example.com bar'), - array('foo@bar.fr@'), ); } From 6f24b0546723d8764d0c4753fbcbe8f567b72588 Mon Sep 17 00:00:00 2001 From: apetitpa Date: Fri, 24 Mar 2017 17:16:55 +0100 Subject: [PATCH 17/51] Switch to `empty` native function to check emptiness Switch to `empty` because depending on the PHP version, substr returns '' or false --- .../Component/Validator/Constraints/EmailValidator.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Validator/Constraints/EmailValidator.php b/src/Symfony/Component/Validator/Constraints/EmailValidator.php index ce42219e26024..1a771debf9bac 100644 --- a/src/Symfony/Component/Validator/Constraints/EmailValidator.php +++ b/src/Symfony/Component/Validator/Constraints/EmailValidator.php @@ -138,7 +138,7 @@ public function validate($value, Constraint $constraint) */ private function checkMX($host) { - return '' !== $host && checkdnsrr($host, 'MX'); + return !empty($host) && checkdnsrr($host, 'MX'); } /** @@ -150,6 +150,6 @@ private function checkMX($host) */ private function checkHost($host) { - return '' !== $host && ($this->checkMX($host) || (checkdnsrr($host, 'A') || checkdnsrr($host, 'AAAA'))); + return !empty($host) && ($this->checkMX($host) || (checkdnsrr($host, 'A') || checkdnsrr($host, 'AAAA'))); } } From d973eb1f7d37113fb824ad933d466b227c675e0e Mon Sep 17 00:00:00 2001 From: apetitpa Date: Fri, 24 Mar 2017 17:17:11 +0100 Subject: [PATCH 18/51] Add a test to prevent future regressions --- .../Tests/Constraints/EmailValidatorTest.php | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/Symfony/Component/Validator/Tests/Constraints/EmailValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/EmailValidatorTest.php index cfa0e99c92325..07d748fe08d06 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/EmailValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/EmailValidatorTest.php @@ -159,4 +159,32 @@ public function testHostnameIsProperlyParsed() $this->assertNoViolation(); } + + public function getCheckTypes() + { + return array( + array('checkMX', Email::MX_CHECK_FAILED_ERROR), + array('checkHost', Email::HOST_CHECK_FAILED_ERROR), + ); + } + + /** + * @dataProvider getCheckTypes + */ + public function testEmptyHostIsNotValid($checkType, $violation) + { + $this->validator->validate( + 'foo@bar.fr@', + new Email(array( + 'message' => 'myMessage', + $checkType => true, + )) + ); + + $this + ->buildViolation('myMessage') + ->setParameter('{{ value }}', '"foo@bar.fr@"') + ->setCode($violation) + ->assertRaised(); + } } From 894127bf09245c648fea8896ca2a0a8c5d0f628a Mon Sep 17 00:00:00 2001 From: apetitpa Date: Fri, 24 Mar 2017 23:08:25 +0100 Subject: [PATCH 19/51] rename dataset provider --- .../Validator/Tests/Constraints/EmailValidatorTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Validator/Tests/Constraints/EmailValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/EmailValidatorTest.php index 07d748fe08d06..18d29f2403214 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/EmailValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/EmailValidatorTest.php @@ -160,7 +160,7 @@ public function testHostnameIsProperlyParsed() $this->assertNoViolation(); } - public function getCheckTypes() + public function provideCheckTypes() { return array( array('checkMX', Email::MX_CHECK_FAILED_ERROR), From 1825d0f2aefd9b36f84f7b86871e76429ac7a0f9 Mon Sep 17 00:00:00 2001 From: apetitpa Date: Fri, 24 Mar 2017 23:09:52 +0100 Subject: [PATCH 20/51] cast substr result to string and remove empty function use --- .../Component/Validator/Constraints/EmailValidator.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/Validator/Constraints/EmailValidator.php b/src/Symfony/Component/Validator/Constraints/EmailValidator.php index 1a771debf9bac..cdd162d816f98 100644 --- a/src/Symfony/Component/Validator/Constraints/EmailValidator.php +++ b/src/Symfony/Component/Validator/Constraints/EmailValidator.php @@ -93,7 +93,7 @@ public function validate($value, Constraint $constraint) return; } - $host = substr($value, strrpos($value, '@') + 1); + $host = (string) substr($value, strrpos($value, '@') + 1); // Check for host DNS resource records if ($constraint->checkMX) { @@ -138,7 +138,7 @@ public function validate($value, Constraint $constraint) */ private function checkMX($host) { - return !empty($host) && checkdnsrr($host, 'MX'); + return '' !== $host && checkdnsrr($host, 'MX'); } /** @@ -150,6 +150,6 @@ private function checkMX($host) */ private function checkHost($host) { - return !empty($host) && ($this->checkMX($host) || (checkdnsrr($host, 'A') || checkdnsrr($host, 'AAAA'))); + return '' !== $host && ($this->checkMX($host) || (checkdnsrr($host, 'A') || checkdnsrr($host, 'AAAA'))); } } From c07fb416ff4c87aed6d628a3fa88712a285e76d0 Mon Sep 17 00:00:00 2001 From: apetitpa Date: Fri, 24 Mar 2017 23:17:19 +0100 Subject: [PATCH 21/51] update dataProvider function name --- .../Validator/Tests/Constraints/EmailValidatorTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Validator/Tests/Constraints/EmailValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/EmailValidatorTest.php index 18d29f2403214..86f33b0adf1b6 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/EmailValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/EmailValidatorTest.php @@ -169,7 +169,7 @@ public function provideCheckTypes() } /** - * @dataProvider getCheckTypes + * @dataProvider provideCheckTypes */ public function testEmptyHostIsNotValid($checkType, $violation) { From 7104c4e849c632c3f31b3cc188498c8cd6d2f64f Mon Sep 17 00:00:00 2001 From: apetitpa Date: Mon, 27 Mar 2017 16:23:37 +0200 Subject: [PATCH 22/51] move provider after test --- .../Tests/Constraints/EmailValidatorTest.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Symfony/Component/Validator/Tests/Constraints/EmailValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/EmailValidatorTest.php index 86f33b0adf1b6..5933bd5ed6a65 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/EmailValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/EmailValidatorTest.php @@ -160,14 +160,6 @@ public function testHostnameIsProperlyParsed() $this->assertNoViolation(); } - public function provideCheckTypes() - { - return array( - array('checkMX', Email::MX_CHECK_FAILED_ERROR), - array('checkHost', Email::HOST_CHECK_FAILED_ERROR), - ); - } - /** * @dataProvider provideCheckTypes */ @@ -187,4 +179,12 @@ public function testEmptyHostIsNotValid($checkType, $violation) ->setCode($violation) ->assertRaised(); } + + public function provideCheckTypes() + { + return array( + array('checkMX', Email::MX_CHECK_FAILED_ERROR), + array('checkHost', Email::HOST_CHECK_FAILED_ERROR), + ); + } } From e333a1a86e895dae1076ecc78e125e00a7d06ea0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1chym=20Tou=C5=A1ek?= Date: Thu, 6 Apr 2017 10:58:34 +0200 Subject: [PATCH 23/51] [Debug] Fix php notice --- src/Symfony/Component/Debug/DebugClassLoader.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Debug/DebugClassLoader.php b/src/Symfony/Component/Debug/DebugClassLoader.php index 603c814b569ea..2230231c8ab73 100644 --- a/src/Symfony/Component/Debug/DebugClassLoader.php +++ b/src/Symfony/Component/Debug/DebugClassLoader.php @@ -186,7 +186,7 @@ public function loadClass($class) $exists = class_exists($class, false) || interface_exists($class, false) || (function_exists('trait_exists') && trait_exists($class, false)); - if ('\\' === $class[0]) { + if ($class !== '' && '\\' === $class[0]) { $class = substr($class, 1); } From ff3cb9cb2708f1b6ec8b480055c4f52798529f1e Mon Sep 17 00:00:00 2001 From: Roland Franssen Date: Fri, 7 Apr 2017 15:10:19 +0200 Subject: [PATCH 24/51] [Console] Inherit phpdoc from OutputFormatterInterface --- .../Console/Formatter/OutputFormatter.php | 33 ++++--------------- .../Formatter/OutputFormatterInterface.php | 2 ++ 2 files changed, 8 insertions(+), 27 deletions(-) diff --git a/src/Symfony/Component/Console/Formatter/OutputFormatter.php b/src/Symfony/Component/Console/Formatter/OutputFormatter.php index 22c13d551e5a7..dc192711e6093 100644 --- a/src/Symfony/Component/Console/Formatter/OutputFormatter.php +++ b/src/Symfony/Component/Console/Formatter/OutputFormatter.php @@ -79,9 +79,7 @@ public function __construct($decorated = false, array $styles = array()) } /** - * Sets the decorated flag. - * - * @param bool $decorated Whether to decorate the messages or not + * {@inheritdoc} */ public function setDecorated($decorated) { @@ -89,9 +87,7 @@ public function setDecorated($decorated) } /** - * Gets the decorated flag. - * - * @return bool true if the output will decorate messages, false otherwise + * {@inheritdoc} */ public function isDecorated() { @@ -99,10 +95,7 @@ public function isDecorated() } /** - * Sets a new style. - * - * @param string $name The style name - * @param OutputFormatterStyleInterface $style The style instance + * {@inheritdoc} */ public function setStyle($name, OutputFormatterStyleInterface $style) { @@ -110,11 +103,7 @@ public function setStyle($name, OutputFormatterStyleInterface $style) } /** - * Checks if output formatter has style with specified name. - * - * @param string $name - * - * @return bool + * {@inheritdoc} */ public function hasStyle($name) { @@ -122,13 +111,7 @@ public function hasStyle($name) } /** - * Gets style options from style with specified name. - * - * @param string $name - * - * @return OutputFormatterStyleInterface - * - * @throws \InvalidArgumentException When style isn't defined + * {@inheritdoc} */ public function getStyle($name) { @@ -140,11 +123,7 @@ public function getStyle($name) } /** - * Formats a message according to the given styles. - * - * @param string $message The message to style - * - * @return string The styled message + * {@inheritdoc} */ public function format($message) { diff --git a/src/Symfony/Component/Console/Formatter/OutputFormatterInterface.php b/src/Symfony/Component/Console/Formatter/OutputFormatterInterface.php index 5a52ba096b230..281e240c5f70d 100644 --- a/src/Symfony/Component/Console/Formatter/OutputFormatterInterface.php +++ b/src/Symfony/Component/Console/Formatter/OutputFormatterInterface.php @@ -55,6 +55,8 @@ public function hasStyle($name); * @param string $name * * @return OutputFormatterStyleInterface + * + * @throws \InvalidArgumentException When style isn't defined */ public function getStyle($name); From 81de5fef4bc93543b6338db8ec459eed32bad1e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Fri, 7 Apr 2017 07:35:24 +0200 Subject: [PATCH 25/51] [ExpressionLanguage] Avoid dependency on ctype This avoids ExpressionLanguage library dependency on ctype. --- src/Symfony/Component/ExpressionLanguage/Lexer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/ExpressionLanguage/Lexer.php b/src/Symfony/Component/ExpressionLanguage/Lexer.php index 8c10b72d86046..9e746fcbde64d 100644 --- a/src/Symfony/Component/ExpressionLanguage/Lexer.php +++ b/src/Symfony/Component/ExpressionLanguage/Lexer.php @@ -45,7 +45,7 @@ public function tokenize($expression) if (preg_match('/[0-9]+(?:\.[0-9]+)?/A', $expression, $match, null, $cursor)) { // numbers $number = (float) $match[0]; // floats - if (ctype_digit($match[0]) && $number <= PHP_INT_MAX) { + if (preg_match('/^[0-9]+$/', $match[0]) && $number <= PHP_INT_MAX) { $number = (int) $match[0]; // integers lower than the maximum } $tokens[] = new Token(Token::NUMBER_TYPE, $number, $cursor + 1); From 5310f11418794e442da8090f633d8ca80ae83403 Mon Sep 17 00:00:00 2001 From: MetalArend Date: Wed, 5 Apr 2017 18:36:09 +0200 Subject: [PATCH 26/51] Add \Traversable typehint to phpdoc --- src/Symfony/Component/Form/DataMapperInterface.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/Form/DataMapperInterface.php b/src/Symfony/Component/Form/DataMapperInterface.php index 779f15383592d..f1867a9f901f4 100644 --- a/src/Symfony/Component/Form/DataMapperInterface.php +++ b/src/Symfony/Component/Form/DataMapperInterface.php @@ -19,8 +19,8 @@ interface DataMapperInterface /** * Maps properties of some data to a list of forms. * - * @param mixed $data Structured data - * @param FormInterface[] $forms A list of {@link FormInterface} instances + * @param mixed $data Structured data + * @param FormInterface[]|\Traversable $forms A list of {@link FormInterface} instances * * @throws Exception\UnexpectedTypeException if the type of the data parameter is not supported. */ @@ -29,8 +29,8 @@ public function mapDataToForms($data, $forms); /** * Maps the data of a list of forms into the properties of some data. * - * @param FormInterface[] $forms A list of {@link FormInterface} instances - * @param mixed $data Structured data + * @param FormInterface[]|\Traversable $forms A list of {@link FormInterface} instances + * @param mixed $data Structured data * * @throws Exception\UnexpectedTypeException if the type of the data parameter is not supported. */ From faf671db0f7493c15fdcef8446b9472a1ce80445 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Tue, 4 Apr 2017 16:26:39 +0200 Subject: [PATCH 27/51] don't keep internal state between parser runs --- src/Symfony/Component/Yaml/Parser.php | 48 +++++++++++++------ .../Component/Yaml/Tests/ParserTest.php | 21 ++++++++ 2 files changed, 55 insertions(+), 14 deletions(-) diff --git a/src/Symfony/Component/Yaml/Parser.php b/src/Symfony/Component/Yaml/Parser.php index 345bcbdac1731..e4d7fe2839782 100644 --- a/src/Symfony/Component/Yaml/Parser.php +++ b/src/Symfony/Component/Yaml/Parser.php @@ -64,23 +64,51 @@ public function parse($value, $exceptionOnInvalidType = false, $objectSupport = if (false === preg_match('//u', $value)) { throw new ParseException('The YAML value does not appear to be valid UTF-8.'); } + + $this->refs = array(); + + $mbEncoding = null; + $e = null; + $data = null; + + if (function_exists('mb_internal_encoding') && ((int) ini_get('mbstring.func_overload')) & 2) { + $mbEncoding = mb_internal_encoding(); + mb_internal_encoding('UTF-8'); + } + + try { + $data = $this->doParse($value, $exceptionOnInvalidType, $objectSupport, $objectForMap); + } catch (\Exception $e) { + } catch (\Throwable $e) { + } + + if (null !== $mbEncoding) { + mb_internal_encoding($mbEncoding); + } + + if (null !== $e) { + throw $e; + } + + return $data; + } + + private function doParse($value, $exceptionOnInvalidType = false, $objectSupport = false, $objectForMap = false) + { $this->currentLineNb = -1; $this->currentLine = ''; $value = $this->cleanup($value); $this->lines = explode("\n", $value); + $this->locallySkippedLineNumbers = array(); if (null === $this->totalNumberOfLines) { $this->totalNumberOfLines = count($this->lines); } - if (function_exists('mb_internal_encoding') && ((int) ini_get('mbstring.func_overload')) & 2) { - $mbEncoding = mb_internal_encoding(); - mb_internal_encoding('UTF-8'); - } - $data = array(); $context = null; $allowOverwrite = false; + while ($this->moveToNextLine()) { if ($this->isCurrentLineEmpty()) { continue; @@ -250,10 +278,6 @@ public function parse($value, $exceptionOnInvalidType = false, $objectSupport = throw $e; } - if (isset($mbEncoding)) { - mb_internal_encoding($mbEncoding); - } - return $value; } @@ -261,10 +285,6 @@ public function parse($value, $exceptionOnInvalidType = false, $objectSupport = } } - if (isset($mbEncoding)) { - mb_internal_encoding($mbEncoding); - } - return empty($data) ? null : $data; } @@ -283,7 +303,7 @@ private function parseBlock($offset, $yaml, $exceptionOnInvalidType, $objectSupp $parser = new self($offset, $this->totalNumberOfLines, $skippedLineNumbers); $parser->refs = &$this->refs; - return $parser->parse($yaml, $exceptionOnInvalidType, $objectSupport, $objectForMap); + return $parser->doParse($yaml, $exceptionOnInvalidType, $objectSupport, $objectForMap); } /** diff --git a/src/Symfony/Component/Yaml/Tests/ParserTest.php b/src/Symfony/Component/Yaml/Tests/ParserTest.php index d6e5f775139ea..1ff5e3e8a5042 100644 --- a/src/Symfony/Component/Yaml/Tests/ParserTest.php +++ b/src/Symfony/Component/Yaml/Tests/ParserTest.php @@ -1158,6 +1158,27 @@ public function testCanParseVeryLongValue() $this->assertEquals($trickyVal, $arrayFromYaml); } + + /** + * @expectedException \Symfony\Component\Yaml\Exception\ParseException + * @expectedExceptionMessage Reference "foo" does not exist at line 2 + */ + public function testParserCleansUpReferencesBetweenRuns() + { + $yaml = <<parser->parse($yaml); + + $yaml = <<parser->parse($yaml); + } } class B From 130ee327d4ea5030073af04c4ae3ea5d7a3aaa2c Mon Sep 17 00:00:00 2001 From: Sebastiaan Stok Date: Sun, 9 Apr 2017 15:37:32 +0200 Subject: [PATCH 28/51] Add `use_strict_mode` in validOptions for session --- .../HttpFoundation/Session/Storage/NativeSessionStorage.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php b/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php index 32979e8b45cbb..4deb58eca2ede 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php @@ -81,6 +81,7 @@ class NativeSessionStorage implements SessionStorageInterface * name, "PHPSESSID" * referer_check, "" * serialize_handler, "php" + * use_strict_mode, "0" * use_cookies, "1" * use_only_cookies, "1" * use_trans_sid, "0" @@ -335,7 +336,7 @@ public function setOptions(array $options) 'entropy_file', 'entropy_length', 'gc_divisor', 'gc_maxlifetime', 'gc_probability', 'hash_bits_per_character', 'hash_function', 'name', 'referer_check', - 'serialize_handler', 'use_cookies', + 'serialize_handler', 'use_strict_mode', 'use_cookies', 'use_only_cookies', 'use_trans_sid', 'upload_progress.enabled', 'upload_progress.cleanup', 'upload_progress.prefix', 'upload_progress.name', 'upload_progress.freq', 'upload_progress.min-freq', 'url_rewriter.tags', From 72d25ccca7896c7f3038c34e15286845deceddbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Mon, 10 Apr 2017 14:16:01 +0200 Subject: [PATCH 29/51] [HttpFoundation] Fix and test status codes according to IANA's data --- .../Component/HttpFoundation/Response.php | 8 +-- .../HttpFoundation/Tests/ResponseTest.php | 61 +++++++++++++++++++ 2 files changed, 65 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/HttpFoundation/Response.php b/src/Symfony/Component/HttpFoundation/Response.php index b19d2122ff6f1..f9512d6706ef9 100644 --- a/src/Symfony/Component/HttpFoundation/Response.php +++ b/src/Symfony/Component/HttpFoundation/Response.php @@ -158,10 +158,10 @@ class Response 410 => 'Gone', 411 => 'Length Required', 412 => 'Precondition Failed', - 413 => 'Request Entity Too Large', - 414 => 'Request-URI Too Long', + 413 => 'Payload Too Large', + 414 => 'URI Too Long', 415 => 'Unsupported Media Type', - 416 => 'Requested Range Not Satisfiable', + 416 => 'Range Not Satisfiable', 417 => 'Expectation Failed', 418 => 'I\'m a teapot', // RFC2324 421 => 'Misdirected Request', // RFC7540 @@ -180,7 +180,7 @@ class Response 503 => 'Service Unavailable', 504 => 'Gateway Timeout', 505 => 'HTTP Version Not Supported', - 506 => 'Variant Also Negotiates (Experimental)', // RFC2295 + 506 => 'Variant Also Negotiates', // RFC2295 507 => 'Insufficient Storage', // RFC4918 508 => 'Loop Detected', // RFC5842 510 => 'Not Extended', // RFC2774 diff --git a/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php b/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php index d73dd3d344c3f..165e1fcf5f0aa 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php @@ -882,6 +882,67 @@ protected function provideResponse() { return new Response(); } + + /** + * @see http://github.com/zendframework/zend-diactoros for the canonical source repository + * + * @author Fábio Pacheco + * @copyright Copyright (c) 2015-2016 Zend Technologies USA Inc. (http://www.zend.com) + * @license https://github.com/zendframework/zend-diactoros/blob/master/LICENSE.md New BSD License + */ + public function ianaCodesReasonPhrasesProvider() + { + if (!in_array('https', stream_get_wrappers(), true)) { + $this->markTestSkipped('The "https" wrapper is not available'); + } + + $ianaHttpStatusCodes = new \DOMDocument(); + + libxml_set_streams_context(stream_context_create(array( + 'http' => array( + 'method' => 'GET', + 'timeout' => 30, + ), + ))); + + $ianaHttpStatusCodes->load('https://www.iana.org/assignments/http-status-codes/http-status-codes.xml'); + if (!$ianaHttpStatusCodes->relaxNGValidate('https://www.iana.org/assignments/http-status-codes/http-status-codes.rng')) { + self::fail('Invalid IANA\'s HTTP status code list.'); + } + + $ianaCodesReasonPhrases = array(); + + $xpath = new \DomXPath($ianaHttpStatusCodes); + $xpath->registerNamespace('ns', 'http://www.iana.org/assignments'); + + $records = $xpath->query('//ns:record'); + foreach ($records as $record) { + $value = $xpath->query('.//ns:value', $record)->item(0)->nodeValue; + $description = $xpath->query('.//ns:description', $record)->item(0)->nodeValue; + + if (in_array($description, array('Unassigned', '(Unused)'), true)) { + continue; + } + + if (preg_match('/^([0-9]+)\s*\-\s*([0-9]+)$/', $value, $matches)) { + for ($value = $matches[1]; $value <= $matches[2]; ++$value) { + $ianaCodesReasonPhrases[] = array($value, $description); + } + } else { + $ianaCodesReasonPhrases[] = array($value, $description); + } + } + + return $ianaCodesReasonPhrases; + } + + /** + * @dataProvider ianaCodesReasonPhrasesProvider + */ + public function testReasonPhraseDefaultsAgainstIana($code, $reasonPhrase) + { + $this->assertEquals($reasonPhrase, Response::$statusTexts[$code]); + } } class StringableObject From c891413f6c82257777eb3673827eea3ee47f0501 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Tue, 11 Apr 2017 09:48:47 +0200 Subject: [PATCH 30/51] [Yaml] release memory after parsing --- src/Symfony/Component/Yaml/Parser.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Symfony/Component/Yaml/Parser.php b/src/Symfony/Component/Yaml/Parser.php index e4d7fe2839782..90a2f34e02123 100644 --- a/src/Symfony/Component/Yaml/Parser.php +++ b/src/Symfony/Component/Yaml/Parser.php @@ -86,6 +86,12 @@ public function parse($value, $exceptionOnInvalidType = false, $objectSupport = mb_internal_encoding($mbEncoding); } + $this->lines = array(); + $this->currentLine = ''; + $this->refs = array(); + $this->skippedLineNumbers = array(); + $this->locallySkippedLineNumbers = array(); + if (null !== $e) { throw $e; } From 3792ee6c930e803348de7d5c0e2a1eefe33c708d Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Wed, 12 Apr 2017 08:19:06 +0200 Subject: [PATCH 31/51] fail when detecting risky tests --- phpunit.xml.dist | 2 ++ src/Symfony/Bridge/Doctrine/phpunit.xml.dist | 2 ++ src/Symfony/Bridge/Monolog/phpunit.xml.dist | 2 ++ src/Symfony/Bridge/PhpUnit/phpunit.xml.dist | 2 ++ src/Symfony/Bridge/ProxyManager/phpunit.xml.dist | 2 ++ src/Symfony/Bridge/Twig/composer.json | 2 +- src/Symfony/Bridge/Twig/phpunit.xml.dist | 2 ++ src/Symfony/Bundle/DebugBundle/phpunit.xml.dist | 2 ++ src/Symfony/Bundle/FrameworkBundle/composer.json | 2 +- src/Symfony/Bundle/FrameworkBundle/phpunit.xml.dist | 2 ++ src/Symfony/Bundle/SecurityBundle/phpunit.xml.dist | 2 ++ src/Symfony/Bundle/TwigBundle/phpunit.xml.dist | 2 ++ src/Symfony/Bundle/WebProfilerBundle/phpunit.xml.dist | 2 ++ src/Symfony/Component/Asset/phpunit.xml.dist | 2 ++ src/Symfony/Component/BrowserKit/phpunit.xml.dist | 2 ++ src/Symfony/Component/ClassLoader/phpunit.xml.dist | 2 ++ src/Symfony/Component/Config/phpunit.xml.dist | 2 ++ .../Console/Tests/Helper/LegacyTableHelperTest.php | 8 ++++---- src/Symfony/Component/Console/phpunit.xml.dist | 2 ++ src/Symfony/Component/CssSelector/phpunit.xml.dist | 2 ++ src/Symfony/Component/Debug/phpunit.xml.dist | 2 ++ .../Component/DependencyInjection/phpunit.xml.dist | 2 ++ src/Symfony/Component/DomCrawler/phpunit.xml.dist | 2 ++ src/Symfony/Component/EventDispatcher/phpunit.xml.dist | 2 ++ src/Symfony/Component/ExpressionLanguage/phpunit.xml.dist | 2 ++ src/Symfony/Component/Filesystem/phpunit.xml.dist | 2 ++ src/Symfony/Component/Finder/phpunit.xml.dist | 2 ++ src/Symfony/Component/Form/phpunit.xml.dist | 2 ++ src/Symfony/Component/HttpFoundation/phpunit.xml.dist | 2 ++ src/Symfony/Component/HttpKernel/phpunit.xml.dist | 2 ++ src/Symfony/Component/Intl/Tests/Locale/LocaleTest.php | 2 ++ src/Symfony/Component/Intl/phpunit.xml.dist | 2 ++ src/Symfony/Component/Locale/phpunit.xml.dist | 2 ++ src/Symfony/Component/OptionsResolver/phpunit.xml.dist | 2 ++ src/Symfony/Component/Process/phpunit.xml.dist | 2 ++ src/Symfony/Component/PropertyAccess/phpunit.xml.dist | 2 ++ src/Symfony/Component/Routing/phpunit.xml.dist | 2 ++ src/Symfony/Component/Security/Acl/phpunit.xml.dist | 2 ++ src/Symfony/Component/Security/Core/phpunit.xml.dist | 2 ++ src/Symfony/Component/Security/Csrf/phpunit.xml.dist | 2 ++ src/Symfony/Component/Security/Http/phpunit.xml.dist | 2 ++ src/Symfony/Component/Security/phpunit.xml.dist | 2 ++ src/Symfony/Component/Serializer/phpunit.xml.dist | 2 ++ src/Symfony/Component/Stopwatch/phpunit.xml.dist | 2 ++ src/Symfony/Component/Templating/phpunit.xml.dist | 2 ++ src/Symfony/Component/Translation/phpunit.xml.dist | 2 ++ src/Symfony/Component/Validator/phpunit.xml.dist | 2 ++ src/Symfony/Component/VarDumper/phpunit.xml.dist | 2 ++ src/Symfony/Component/Yaml/phpunit.xml.dist | 2 ++ 49 files changed, 98 insertions(+), 6 deletions(-) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 34e951b4fc42a..13156a72ce272 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -5,6 +5,8 @@ backupGlobals="false" colors="true" bootstrap="vendor/autoload.php" + failOnRisky="true" + failOnWarning="true" > diff --git a/src/Symfony/Bridge/Doctrine/phpunit.xml.dist b/src/Symfony/Bridge/Doctrine/phpunit.xml.dist index c006d232219a4..24f92f2ab8e2f 100644 --- a/src/Symfony/Bridge/Doctrine/phpunit.xml.dist +++ b/src/Symfony/Bridge/Doctrine/phpunit.xml.dist @@ -5,6 +5,8 @@ backupGlobals="false" colors="true" bootstrap="vendor/autoload.php" + failOnRisky="true" + failOnWarning="true" > diff --git a/src/Symfony/Bridge/Monolog/phpunit.xml.dist b/src/Symfony/Bridge/Monolog/phpunit.xml.dist index 8a60f06a7a310..28905908b1897 100644 --- a/src/Symfony/Bridge/Monolog/phpunit.xml.dist +++ b/src/Symfony/Bridge/Monolog/phpunit.xml.dist @@ -5,6 +5,8 @@ backupGlobals="false" colors="true" bootstrap="vendor/autoload.php" + failOnRisky="true" + failOnWarning="true" > diff --git a/src/Symfony/Bridge/PhpUnit/phpunit.xml.dist b/src/Symfony/Bridge/PhpUnit/phpunit.xml.dist index 9b64b02947c0e..816cfe4927ed3 100644 --- a/src/Symfony/Bridge/PhpUnit/phpunit.xml.dist +++ b/src/Symfony/Bridge/PhpUnit/phpunit.xml.dist @@ -5,6 +5,8 @@ backupGlobals="false" colors="true" bootstrap="vendor/autoload.php" + failOnRisky="true" + failOnWarning="true" > diff --git a/src/Symfony/Bridge/ProxyManager/phpunit.xml.dist b/src/Symfony/Bridge/ProxyManager/phpunit.xml.dist index 60980be9e531e..f280e037fec08 100644 --- a/src/Symfony/Bridge/ProxyManager/phpunit.xml.dist +++ b/src/Symfony/Bridge/ProxyManager/phpunit.xml.dist @@ -5,6 +5,8 @@ backupGlobals="false" colors="true" bootstrap="vendor/autoload.php" + failOnRisky="true" + failOnWarning="true" > diff --git a/src/Symfony/Bridge/Twig/composer.json b/src/Symfony/Bridge/Twig/composer.json index d66be3d49e287..3bc0aa6d0cddf 100644 --- a/src/Symfony/Bridge/Twig/composer.json +++ b/src/Symfony/Bridge/Twig/composer.json @@ -22,7 +22,7 @@ "require-dev": { "symfony/asset": "~2.7", "symfony/finder": "~2.3", - "symfony/form": "~2.7.25|^2.8.18", + "symfony/form": "~2.7.26|^2.8.19", "symfony/http-kernel": "~2.3", "symfony/intl": "~2.3", "symfony/routing": "~2.2", diff --git a/src/Symfony/Bridge/Twig/phpunit.xml.dist b/src/Symfony/Bridge/Twig/phpunit.xml.dist index 10c0be1142712..642b7d19d8b70 100644 --- a/src/Symfony/Bridge/Twig/phpunit.xml.dist +++ b/src/Symfony/Bridge/Twig/phpunit.xml.dist @@ -5,6 +5,8 @@ backupGlobals="false" colors="true" bootstrap="vendor/autoload.php" + failOnRisky="true" + failOnWarning="true" > diff --git a/src/Symfony/Bundle/DebugBundle/phpunit.xml.dist b/src/Symfony/Bundle/DebugBundle/phpunit.xml.dist index 90ec0a5dba514..3df3f74a7d9a5 100644 --- a/src/Symfony/Bundle/DebugBundle/phpunit.xml.dist +++ b/src/Symfony/Bundle/DebugBundle/phpunit.xml.dist @@ -5,6 +5,8 @@ backupGlobals="false" colors="true" bootstrap="vendor/autoload.php" + failOnRisky="true" + failOnWarning="true" > diff --git a/src/Symfony/Bundle/FrameworkBundle/composer.json b/src/Symfony/Bundle/FrameworkBundle/composer.json index cd615c31d11b5..9ed3b0807d97f 100644 --- a/src/Symfony/Bundle/FrameworkBundle/composer.json +++ b/src/Symfony/Bundle/FrameworkBundle/composer.json @@ -40,7 +40,7 @@ "symfony/dom-crawler": "^2.0.5", "symfony/intl": "~2.3", "symfony/security": "~2.6", - "symfony/form": "~2.7.25|^2.8.18", + "symfony/form": "~2.7.26|^2.8.19", "symfony/class-loader": "~2.1", "symfony/expression-language": "~2.6", "symfony/process": "^2.0.5", diff --git a/src/Symfony/Bundle/FrameworkBundle/phpunit.xml.dist b/src/Symfony/Bundle/FrameworkBundle/phpunit.xml.dist index 1d25eeb3304c5..cd0ded87eee1e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/phpunit.xml.dist +++ b/src/Symfony/Bundle/FrameworkBundle/phpunit.xml.dist @@ -5,6 +5,8 @@ backupGlobals="false" colors="true" bootstrap="vendor/autoload.php" + failOnRisky="true" + failOnWarning="true" > diff --git a/src/Symfony/Bundle/SecurityBundle/phpunit.xml.dist b/src/Symfony/Bundle/SecurityBundle/phpunit.xml.dist index a7fdc326c4571..8636f70c187a5 100644 --- a/src/Symfony/Bundle/SecurityBundle/phpunit.xml.dist +++ b/src/Symfony/Bundle/SecurityBundle/phpunit.xml.dist @@ -5,6 +5,8 @@ backupGlobals="false" colors="true" bootstrap="vendor/autoload.php" + failOnRisky="true" + failOnWarning="true" > diff --git a/src/Symfony/Bundle/TwigBundle/phpunit.xml.dist b/src/Symfony/Bundle/TwigBundle/phpunit.xml.dist index 9a8c38f26ef33..5fed357742181 100644 --- a/src/Symfony/Bundle/TwigBundle/phpunit.xml.dist +++ b/src/Symfony/Bundle/TwigBundle/phpunit.xml.dist @@ -5,6 +5,8 @@ backupGlobals="false" colors="true" bootstrap="vendor/autoload.php" + failOnRisky="true" + failOnWarning="true" > diff --git a/src/Symfony/Bundle/WebProfilerBundle/phpunit.xml.dist b/src/Symfony/Bundle/WebProfilerBundle/phpunit.xml.dist index 2bcccd6667a26..e678afd54f2c9 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/phpunit.xml.dist +++ b/src/Symfony/Bundle/WebProfilerBundle/phpunit.xml.dist @@ -5,6 +5,8 @@ backupGlobals="false" colors="true" bootstrap="vendor/autoload.php" + failOnRisky="true" + failOnWarning="true" > diff --git a/src/Symfony/Component/Asset/phpunit.xml.dist b/src/Symfony/Component/Asset/phpunit.xml.dist index b66906d6dab39..906578a81d9f4 100644 --- a/src/Symfony/Component/Asset/phpunit.xml.dist +++ b/src/Symfony/Component/Asset/phpunit.xml.dist @@ -5,6 +5,8 @@ backupGlobals="false" colors="true" bootstrap="vendor/autoload.php" + failOnRisky="true" + failOnWarning="true" > diff --git a/src/Symfony/Component/BrowserKit/phpunit.xml.dist b/src/Symfony/Component/BrowserKit/phpunit.xml.dist index d76b2b98afd80..fa6d06a8068c8 100644 --- a/src/Symfony/Component/BrowserKit/phpunit.xml.dist +++ b/src/Symfony/Component/BrowserKit/phpunit.xml.dist @@ -5,6 +5,8 @@ backupGlobals="false" colors="true" bootstrap="vendor/autoload.php" + failOnRisky="true" + failOnWarning="true" > diff --git a/src/Symfony/Component/ClassLoader/phpunit.xml.dist b/src/Symfony/Component/ClassLoader/phpunit.xml.dist index 4856db5be65d1..5158b22f27c88 100644 --- a/src/Symfony/Component/ClassLoader/phpunit.xml.dist +++ b/src/Symfony/Component/ClassLoader/phpunit.xml.dist @@ -5,6 +5,8 @@ backupGlobals="false" colors="true" bootstrap="vendor/autoload.php" + failOnRisky="true" + failOnWarning="true" > diff --git a/src/Symfony/Component/Config/phpunit.xml.dist b/src/Symfony/Component/Config/phpunit.xml.dist index 3fe6fd87c8499..36ef339fd78e4 100644 --- a/src/Symfony/Component/Config/phpunit.xml.dist +++ b/src/Symfony/Component/Config/phpunit.xml.dist @@ -5,6 +5,8 @@ backupGlobals="false" colors="true" bootstrap="vendor/autoload.php" + failOnRisky="true" + failOnWarning="true" > diff --git a/src/Symfony/Component/Console/Tests/Helper/LegacyTableHelperTest.php b/src/Symfony/Component/Console/Tests/Helper/LegacyTableHelperTest.php index 7c3130945366e..9fdc1fb384398 100644 --- a/src/Symfony/Component/Console/Tests/Helper/LegacyTableHelperTest.php +++ b/src/Symfony/Component/Console/Tests/Helper/LegacyTableHelperTest.php @@ -34,7 +34,7 @@ protected function tearDown() } /** - * @dataProvider testRenderProvider + * @dataProvider renderProvider */ public function testRender($headers, $rows, $layout, $expected) { @@ -50,7 +50,7 @@ public function testRender($headers, $rows, $layout, $expected) } /** - * @dataProvider testRenderProvider + * @dataProvider renderProvider */ public function testRenderAddRows($headers, $rows, $layout, $expected) { @@ -66,7 +66,7 @@ public function testRenderAddRows($headers, $rows, $layout, $expected) } /** - * @dataProvider testRenderProvider + * @dataProvider renderProvider */ public function testRenderAddRowsOneByOne($headers, $rows, $layout, $expected) { @@ -83,7 +83,7 @@ public function testRenderAddRowsOneByOne($headers, $rows, $layout, $expected) $this->assertEquals($expected, $this->getOutputContent($output)); } - public function testRenderProvider() + public function renderProvider() { $books = array( array('99921-58-10-7', 'Divine Comedy', 'Dante Alighieri'), diff --git a/src/Symfony/Component/Console/phpunit.xml.dist b/src/Symfony/Component/Console/phpunit.xml.dist index ae0dcbeaba41c..7e7ff5ba89250 100644 --- a/src/Symfony/Component/Console/phpunit.xml.dist +++ b/src/Symfony/Component/Console/phpunit.xml.dist @@ -5,6 +5,8 @@ backupGlobals="false" colors="true" bootstrap="vendor/autoload.php" + failOnRisky="true" + failOnWarning="true" > diff --git a/src/Symfony/Component/CssSelector/phpunit.xml.dist b/src/Symfony/Component/CssSelector/phpunit.xml.dist index 14a320c873c11..65ff1827a3bab 100644 --- a/src/Symfony/Component/CssSelector/phpunit.xml.dist +++ b/src/Symfony/Component/CssSelector/phpunit.xml.dist @@ -5,6 +5,8 @@ backupGlobals="false" colors="true" bootstrap="vendor/autoload.php" + failOnRisky="true" + failOnWarning="true" > diff --git a/src/Symfony/Component/Debug/phpunit.xml.dist b/src/Symfony/Component/Debug/phpunit.xml.dist index e99c4ddf44603..12e58612bc5f5 100644 --- a/src/Symfony/Component/Debug/phpunit.xml.dist +++ b/src/Symfony/Component/Debug/phpunit.xml.dist @@ -5,6 +5,8 @@ backupGlobals="false" colors="true" bootstrap="vendor/autoload.php" + failOnRisky="true" + failOnWarning="true" > diff --git a/src/Symfony/Component/DependencyInjection/phpunit.xml.dist b/src/Symfony/Component/DependencyInjection/phpunit.xml.dist index 86252d0456ba9..781f767d54482 100644 --- a/src/Symfony/Component/DependencyInjection/phpunit.xml.dist +++ b/src/Symfony/Component/DependencyInjection/phpunit.xml.dist @@ -5,6 +5,8 @@ backupGlobals="false" colors="true" bootstrap="vendor/autoload.php" + failOnRisky="true" + failOnWarning="true" > diff --git a/src/Symfony/Component/DomCrawler/phpunit.xml.dist b/src/Symfony/Component/DomCrawler/phpunit.xml.dist index d15dd6a48ed1e..ad714a8fd81c0 100644 --- a/src/Symfony/Component/DomCrawler/phpunit.xml.dist +++ b/src/Symfony/Component/DomCrawler/phpunit.xml.dist @@ -5,6 +5,8 @@ backupGlobals="false" colors="true" bootstrap="vendor/autoload.php" + failOnRisky="true" + failOnWarning="true" > diff --git a/src/Symfony/Component/EventDispatcher/phpunit.xml.dist b/src/Symfony/Component/EventDispatcher/phpunit.xml.dist index ae0586e0b33de..b3ad1bdf5a8e3 100644 --- a/src/Symfony/Component/EventDispatcher/phpunit.xml.dist +++ b/src/Symfony/Component/EventDispatcher/phpunit.xml.dist @@ -5,6 +5,8 @@ backupGlobals="false" colors="true" bootstrap="vendor/autoload.php" + failOnRisky="true" + failOnWarning="true" > diff --git a/src/Symfony/Component/ExpressionLanguage/phpunit.xml.dist b/src/Symfony/Component/ExpressionLanguage/phpunit.xml.dist index 183770651e26d..e7ecd6fb2b0ba 100644 --- a/src/Symfony/Component/ExpressionLanguage/phpunit.xml.dist +++ b/src/Symfony/Component/ExpressionLanguage/phpunit.xml.dist @@ -10,6 +10,8 @@ stopOnFailure="false" syntaxCheck="false" bootstrap="vendor/autoload.php" + failOnRisky="true" + failOnWarning="true" > diff --git a/src/Symfony/Component/Filesystem/phpunit.xml.dist b/src/Symfony/Component/Filesystem/phpunit.xml.dist index d066ed7969868..7bba6fc2f0dad 100644 --- a/src/Symfony/Component/Filesystem/phpunit.xml.dist +++ b/src/Symfony/Component/Filesystem/phpunit.xml.dist @@ -5,6 +5,8 @@ backupGlobals="false" colors="true" bootstrap="vendor/autoload.php" + failOnRisky="true" + failOnWarning="true" > diff --git a/src/Symfony/Component/Finder/phpunit.xml.dist b/src/Symfony/Component/Finder/phpunit.xml.dist index 631e570b9479f..0e1a8669beabe 100644 --- a/src/Symfony/Component/Finder/phpunit.xml.dist +++ b/src/Symfony/Component/Finder/phpunit.xml.dist @@ -5,6 +5,8 @@ backupGlobals="false" colors="true" bootstrap="vendor/autoload.php" + failOnRisky="true" + failOnWarning="true" > diff --git a/src/Symfony/Component/Form/phpunit.xml.dist b/src/Symfony/Component/Form/phpunit.xml.dist index 1c4acf476238d..b834e2f33a5b4 100644 --- a/src/Symfony/Component/Form/phpunit.xml.dist +++ b/src/Symfony/Component/Form/phpunit.xml.dist @@ -5,6 +5,8 @@ backupGlobals="false" colors="true" bootstrap="vendor/autoload.php" + failOnRisky="true" + failOnWarning="true" > diff --git a/src/Symfony/Component/HttpFoundation/phpunit.xml.dist b/src/Symfony/Component/HttpFoundation/phpunit.xml.dist index 9ffdb43a2d744..c1d61f8bf1da0 100644 --- a/src/Symfony/Component/HttpFoundation/phpunit.xml.dist +++ b/src/Symfony/Component/HttpFoundation/phpunit.xml.dist @@ -5,6 +5,8 @@ backupGlobals="false" colors="true" bootstrap="vendor/autoload.php" + failOnRisky="true" + failOnWarning="true" > diff --git a/src/Symfony/Component/HttpKernel/phpunit.xml.dist b/src/Symfony/Component/HttpKernel/phpunit.xml.dist index b29969b36fe23..e0de769dd7afc 100644 --- a/src/Symfony/Component/HttpKernel/phpunit.xml.dist +++ b/src/Symfony/Component/HttpKernel/phpunit.xml.dist @@ -5,6 +5,8 @@ backupGlobals="false" colors="true" bootstrap="vendor/autoload.php" + failOnRisky="true" + failOnWarning="true" > diff --git a/src/Symfony/Component/Intl/Tests/Locale/LocaleTest.php b/src/Symfony/Component/Intl/Tests/Locale/LocaleTest.php index 94572e6f2a60d..5ee414a1c2506 100644 --- a/src/Symfony/Component/Intl/Tests/Locale/LocaleTest.php +++ b/src/Symfony/Component/Intl/Tests/Locale/LocaleTest.php @@ -153,6 +153,8 @@ public function testSetDefault() public function testSetDefaultAcceptsEn() { $this->call('setDefault', 'en'); + + $this->assertSame('en', $this->call('getDefault')); } protected function call($methodName) diff --git a/src/Symfony/Component/Intl/phpunit.xml.dist b/src/Symfony/Component/Intl/phpunit.xml.dist index 9e7ce2f0b2642..a3fcd7c9a9127 100644 --- a/src/Symfony/Component/Intl/phpunit.xml.dist +++ b/src/Symfony/Component/Intl/phpunit.xml.dist @@ -5,6 +5,8 @@ backupGlobals="false" colors="true" bootstrap="vendor/autoload.php" + failOnRisky="true" + failOnWarning="true" > diff --git a/src/Symfony/Component/Locale/phpunit.xml.dist b/src/Symfony/Component/Locale/phpunit.xml.dist index 0d9b637cc78d1..19f26f880fd4e 100644 --- a/src/Symfony/Component/Locale/phpunit.xml.dist +++ b/src/Symfony/Component/Locale/phpunit.xml.dist @@ -5,6 +5,8 @@ backupGlobals="false" colors="true" bootstrap="vendor/autoload.php" + failOnRisky="true" + failOnWarning="true" > diff --git a/src/Symfony/Component/OptionsResolver/phpunit.xml.dist b/src/Symfony/Component/OptionsResolver/phpunit.xml.dist index abf84614bcf76..7e04e6049127d 100644 --- a/src/Symfony/Component/OptionsResolver/phpunit.xml.dist +++ b/src/Symfony/Component/OptionsResolver/phpunit.xml.dist @@ -5,6 +5,8 @@ backupGlobals="false" colors="true" bootstrap="vendor/autoload.php" + failOnRisky="true" + failOnWarning="true" > diff --git a/src/Symfony/Component/Process/phpunit.xml.dist b/src/Symfony/Component/Process/phpunit.xml.dist index 788500084abf8..d38846730d72b 100644 --- a/src/Symfony/Component/Process/phpunit.xml.dist +++ b/src/Symfony/Component/Process/phpunit.xml.dist @@ -5,6 +5,8 @@ backupGlobals="false" colors="true" bootstrap="vendor/autoload.php" + failOnRisky="true" + failOnWarning="true" > diff --git a/src/Symfony/Component/PropertyAccess/phpunit.xml.dist b/src/Symfony/Component/PropertyAccess/phpunit.xml.dist index b0b20c1bd9460..ebfc5648cb360 100644 --- a/src/Symfony/Component/PropertyAccess/phpunit.xml.dist +++ b/src/Symfony/Component/PropertyAccess/phpunit.xml.dist @@ -5,6 +5,8 @@ backupGlobals="false" colors="true" bootstrap="vendor/autoload.php" + failOnRisky="true" + failOnWarning="true" > diff --git a/src/Symfony/Component/Routing/phpunit.xml.dist b/src/Symfony/Component/Routing/phpunit.xml.dist index b69f066ac1b2f..bcc0959522cb6 100644 --- a/src/Symfony/Component/Routing/phpunit.xml.dist +++ b/src/Symfony/Component/Routing/phpunit.xml.dist @@ -5,6 +5,8 @@ backupGlobals="false" colors="true" bootstrap="vendor/autoload.php" + failOnRisky="true" + failOnWarning="true" > diff --git a/src/Symfony/Component/Security/Acl/phpunit.xml.dist b/src/Symfony/Component/Security/Acl/phpunit.xml.dist index b1ea04797a370..35adff6cd5ba6 100644 --- a/src/Symfony/Component/Security/Acl/phpunit.xml.dist +++ b/src/Symfony/Component/Security/Acl/phpunit.xml.dist @@ -10,6 +10,8 @@ stopOnFailure="false" syntaxCheck="false" bootstrap="vendor/autoload.php" + failOnRisky="true" + failOnWarning="true" > diff --git a/src/Symfony/Component/Security/Core/phpunit.xml.dist b/src/Symfony/Component/Security/Core/phpunit.xml.dist index 2dc341abcba02..658f462af2ecb 100644 --- a/src/Symfony/Component/Security/Core/phpunit.xml.dist +++ b/src/Symfony/Component/Security/Core/phpunit.xml.dist @@ -10,6 +10,8 @@ stopOnFailure="false" syntaxCheck="false" bootstrap="vendor/autoload.php" + failOnRisky="true" + failOnWarning="true" > diff --git a/src/Symfony/Component/Security/Csrf/phpunit.xml.dist b/src/Symfony/Component/Security/Csrf/phpunit.xml.dist index f5b1e65c7192a..f5ad399666dfe 100644 --- a/src/Symfony/Component/Security/Csrf/phpunit.xml.dist +++ b/src/Symfony/Component/Security/Csrf/phpunit.xml.dist @@ -10,6 +10,8 @@ stopOnFailure="false" syntaxCheck="false" bootstrap="vendor/autoload.php" + failOnRisky="true" + failOnWarning="true" > diff --git a/src/Symfony/Component/Security/Http/phpunit.xml.dist b/src/Symfony/Component/Security/Http/phpunit.xml.dist index 8d636e93f1be6..9720d96e163d1 100644 --- a/src/Symfony/Component/Security/Http/phpunit.xml.dist +++ b/src/Symfony/Component/Security/Http/phpunit.xml.dist @@ -10,6 +10,8 @@ stopOnFailure="false" syntaxCheck="false" bootstrap="vendor/autoload.php" + failOnRisky="true" + failOnWarning="true" > diff --git a/src/Symfony/Component/Security/phpunit.xml.dist b/src/Symfony/Component/Security/phpunit.xml.dist index 6b56bf247124c..72d84877a9777 100644 --- a/src/Symfony/Component/Security/phpunit.xml.dist +++ b/src/Symfony/Component/Security/phpunit.xml.dist @@ -5,6 +5,8 @@ backupGlobals="false" colors="true" bootstrap="vendor/autoload.php" + failOnRisky="true" + failOnWarning="true" > diff --git a/src/Symfony/Component/Serializer/phpunit.xml.dist b/src/Symfony/Component/Serializer/phpunit.xml.dist index 4799e3cf2f1dd..ce9af71d90a7c 100644 --- a/src/Symfony/Component/Serializer/phpunit.xml.dist +++ b/src/Symfony/Component/Serializer/phpunit.xml.dist @@ -5,6 +5,8 @@ backupGlobals="false" colors="true" bootstrap="vendor/autoload.php" + failOnRisky="true" + failOnWarning="true" > diff --git a/src/Symfony/Component/Stopwatch/phpunit.xml.dist b/src/Symfony/Component/Stopwatch/phpunit.xml.dist index b16dcaebf9a47..f28559a6aa16e 100644 --- a/src/Symfony/Component/Stopwatch/phpunit.xml.dist +++ b/src/Symfony/Component/Stopwatch/phpunit.xml.dist @@ -5,6 +5,8 @@ backupGlobals="false" colors="true" bootstrap="vendor/autoload.php" + failOnRisky="true" + failOnWarning="true" > diff --git a/src/Symfony/Component/Templating/phpunit.xml.dist b/src/Symfony/Component/Templating/phpunit.xml.dist index 109584e805db2..8be97b57b188e 100644 --- a/src/Symfony/Component/Templating/phpunit.xml.dist +++ b/src/Symfony/Component/Templating/phpunit.xml.dist @@ -5,6 +5,8 @@ backupGlobals="false" colors="true" bootstrap="vendor/autoload.php" + failOnRisky="true" + failOnWarning="true" > diff --git a/src/Symfony/Component/Translation/phpunit.xml.dist b/src/Symfony/Component/Translation/phpunit.xml.dist index c25ec5eda6940..1fafa4691bc1d 100644 --- a/src/Symfony/Component/Translation/phpunit.xml.dist +++ b/src/Symfony/Component/Translation/phpunit.xml.dist @@ -5,6 +5,8 @@ backupGlobals="false" colors="true" bootstrap="vendor/autoload.php" + failOnRisky="true" + failOnWarning="true" > diff --git a/src/Symfony/Component/Validator/phpunit.xml.dist b/src/Symfony/Component/Validator/phpunit.xml.dist index cf8c343863e5d..0e82129d79d8e 100644 --- a/src/Symfony/Component/Validator/phpunit.xml.dist +++ b/src/Symfony/Component/Validator/phpunit.xml.dist @@ -5,6 +5,8 @@ backupGlobals="false" colors="true" bootstrap="vendor/autoload.php" + failOnRisky="true" + failOnWarning="true" > diff --git a/src/Symfony/Component/VarDumper/phpunit.xml.dist b/src/Symfony/Component/VarDumper/phpunit.xml.dist index bb16a3a4ec02c..1c03ff68d8866 100644 --- a/src/Symfony/Component/VarDumper/phpunit.xml.dist +++ b/src/Symfony/Component/VarDumper/phpunit.xml.dist @@ -5,6 +5,8 @@ backupGlobals="false" colors="true" bootstrap="vendor/autoload.php" + failOnRisky="true" + failOnWarning="true" > diff --git a/src/Symfony/Component/Yaml/phpunit.xml.dist b/src/Symfony/Component/Yaml/phpunit.xml.dist index 6bdbea16e6426..7c732f8a78358 100644 --- a/src/Symfony/Component/Yaml/phpunit.xml.dist +++ b/src/Symfony/Component/Yaml/phpunit.xml.dist @@ -5,6 +5,8 @@ backupGlobals="false" colors="true" bootstrap="vendor/autoload.php" + failOnRisky="true" + failOnWarning="true" > From 6764dcdf390c2fc68abe53d74629c1942d625c68 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 12 Apr 2017 14:44:35 +0200 Subject: [PATCH 32/51] Prevent double registrations related to tag priorities --- .../Compiler/SerializerPass.php | 8 +++--- .../Compiler/SerializerPassTest.php | 6 ++--- .../Compiler/TwigLoaderPass.php | 26 ++++++++----------- 3 files changed, 17 insertions(+), 23 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/SerializerPass.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/SerializerPass.php index aa449dd4c83ee..21bc2dac30a64 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/SerializerPass.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/SerializerPass.php @@ -47,11 +47,9 @@ private function findAndSortTaggedServices($tagName, ContainerBuilder $container } $sortedServices = array(); - foreach ($services as $serviceId => $tags) { - foreach ($tags as $tag) { - $priority = isset($tag['priority']) ? $tag['priority'] : 0; - $sortedServices[$priority][] = new Reference($serviceId); - } + foreach ($services as $serviceId => $attributes) { + $priority = isset($attributes[0]['priority']) ? $attributes[0]['priority'] : 0; + $sortedServices[$priority][] = new Reference($serviceId); } krsort($sortedServices); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/SerializerPassTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/SerializerPassTest.php index 0df5bfd7cd866..6fa27be17a3db 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/SerializerPassTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/SerializerPassTest.php @@ -72,9 +72,9 @@ public function testThrowExceptionWhenNoEncoders() public function testServicesAreOrderedAccordingToPriority() { $services = array( - 'n3' => array('tag' => array()), - 'n1' => array('tag' => array('priority' => 200)), - 'n2' => array('tag' => array('priority' => 100)), + 'n3' => array(array()), + 'n1' => array(array('priority' => 200)), + 'n2' => array(array('priority' => 100)), ); $expected = array( diff --git a/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/TwigLoaderPass.php b/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/TwigLoaderPass.php index bc3b71c696ed7..fc670e7cd1ae1 100644 --- a/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/TwigLoaderPass.php +++ b/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/TwigLoaderPass.php @@ -29,27 +29,23 @@ public function process(ContainerBuilder $container) return; } - // register additional template loaders - $loaderIds = $container->findTaggedServiceIds('twig.loader'); + $prioritizedLoaders = array(); + $found = 0; - if (count($loaderIds) === 0) { + foreach ($container->findTaggedServiceIds('twig.loader') as $id => $attributes) { + $priority = isset($attributes[0]['priority']) ? $attributes[0]['priority'] : 0; + $prioritizedLoaders[$priority][] = $id; + ++$found; + } + + if (!$found) { throw new LogicException('No twig loaders found. You need to tag at least one loader with "twig.loader"'); } - if (count($loaderIds) === 1) { - $container->setAlias('twig.loader', key($loaderIds)); + if (1 === $found) { + $container->setAlias('twig.loader', $id); } else { $chainLoader = $container->getDefinition('twig.loader.chain'); - - $prioritizedLoaders = array(); - - foreach ($loaderIds as $id => $tags) { - foreach ($tags as $tag) { - $priority = isset($tag['priority']) ? $tag['priority'] : 0; - $prioritizedLoaders[$priority][] = $id; - } - } - krsort($prioritizedLoaders); foreach ($prioritizedLoaders as $loaders) { From 53ad49b4ef13f11a1af7877b5aa024f8782958b4 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Wed, 12 Apr 2017 21:18:21 +0200 Subject: [PATCH 33/51] unify PHPUnit config files * add XML namespace attributes * remove attributes using default values * remove unknown `syntaxCheck` option --- .../Component/ExpressionLanguage/phpunit.xml.dist | 11 +++-------- src/Symfony/Component/Security/Acl/phpunit.xml.dist | 11 +++-------- src/Symfony/Component/Security/Core/phpunit.xml.dist | 11 +++-------- src/Symfony/Component/Security/Csrf/phpunit.xml.dist | 11 +++-------- src/Symfony/Component/Security/Http/phpunit.xml.dist | 11 +++-------- 5 files changed, 15 insertions(+), 40 deletions(-) diff --git a/src/Symfony/Component/ExpressionLanguage/phpunit.xml.dist b/src/Symfony/Component/ExpressionLanguage/phpunit.xml.dist index e7ecd6fb2b0ba..517322fb4fcd7 100644 --- a/src/Symfony/Component/ExpressionLanguage/phpunit.xml.dist +++ b/src/Symfony/Component/ExpressionLanguage/phpunit.xml.dist @@ -1,14 +1,9 @@ - - - - - Date: Thu, 13 Apr 2017 00:18:28 +0200 Subject: [PATCH 34/51] Add @throws phpdoc --- src/Symfony/Component/Console/Command/Command.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Symfony/Component/Console/Command/Command.php b/src/Symfony/Component/Console/Command/Command.php index ff4075962e45a..6b91e548e64e1 100644 --- a/src/Symfony/Component/Console/Command/Command.php +++ b/src/Symfony/Component/Console/Command/Command.php @@ -202,6 +202,8 @@ protected function initialize(InputInterface $input, OutputInterface $output) * * @return int The command exit code * + * @throws \Exception When binding input fails. Bypass this by calling {@link ignoreValidationErrors()}. + * * @see setCode() * @see execute() */ From af3424fb959eef82e2bab3374041de6a90a78ffd Mon Sep 17 00:00:00 2001 From: Nikolay Labinskiy Date: Thu, 13 Apr 2017 14:19:24 +0300 Subject: [PATCH 35/51] [HttpFoundation] Fix getClientIp @return docblock --- src/Symfony/Component/HttpFoundation/Request.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php index d84dbefa7c63b..f38560473ad0c 100644 --- a/src/Symfony/Component/HttpFoundation/Request.php +++ b/src/Symfony/Component/HttpFoundation/Request.php @@ -850,7 +850,7 @@ public function getClientIps() * ("Client-Ip" for instance), configure it via "setTrustedHeaderName()" with * the "client-ip" key. * - * @return string The client IP address + * @return string|null The client IP address * * @see getClientIps() * @see http://en.wikipedia.org/wiki/X-Forwarded-For From 4d2c454fadd8e9d042d3355b73d527167cce8a13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Thu, 13 Apr 2017 21:16:53 +0200 Subject: [PATCH 36/51] [HttpFoundation] Store IANA's RNG files in the repository --- .../HttpFoundation/Tests/ResponseTest.php | 2 +- .../Tests/schema/http-status-codes.rng | 31 +++ .../Tests/schema/iana-registry.rng | 198 ++++++++++++++++++ 3 files changed, 230 insertions(+), 1 deletion(-) create mode 100644 src/Symfony/Component/HttpFoundation/Tests/schema/http-status-codes.rng create mode 100644 src/Symfony/Component/HttpFoundation/Tests/schema/iana-registry.rng diff --git a/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php b/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php index 165e1fcf5f0aa..8043ee45c19e4 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php @@ -906,7 +906,7 @@ public function ianaCodesReasonPhrasesProvider() ))); $ianaHttpStatusCodes->load('https://www.iana.org/assignments/http-status-codes/http-status-codes.xml'); - if (!$ianaHttpStatusCodes->relaxNGValidate('https://www.iana.org/assignments/http-status-codes/http-status-codes.rng')) { + if (!$ianaHttpStatusCodes->relaxNGValidate(__DIR__.'/schema/http-status-codes.rng')) { self::fail('Invalid IANA\'s HTTP status code list.'); } diff --git a/src/Symfony/Component/HttpFoundation/Tests/schema/http-status-codes.rng b/src/Symfony/Component/HttpFoundation/Tests/schema/http-status-codes.rng new file mode 100644 index 0000000000000..73708ca680416 --- /dev/null +++ b/src/Symfony/Component/HttpFoundation/Tests/schema/http-status-codes.rng @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Symfony/Component/HttpFoundation/Tests/schema/iana-registry.rng b/src/Symfony/Component/HttpFoundation/Tests/schema/iana-registry.rng new file mode 100644 index 0000000000000..b9c3ca9d94003 --- /dev/null +++ b/src/Symfony/Component/HttpFoundation/Tests/schema/iana-registry.rng @@ -0,0 +1,198 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + uri + + + + rfc + + + (rfc|bcp|std)\d+ + + + + + rfc-errata + + + + draft + + + (draft|RFC)(-[a-zA-Z0-9]+)+ + + + + + registry + + + + person + + + + text + + + note + + + + unicode + + + ucd\d+\.\d+\.\d+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + (\d+|0x[\da-fA-F]+)(\s*-\s*(\d+|0x[\da-fA-F]+))? + + + + + + + + + + + + + 0x[0-9]{8} + + + + + + [0-1]+ + + + + + + + + + + + + + + + + + + + + + + legacy + mib + template + json + + + + + + + + + + From 67e249dc814042e3d3e2fe0497cf944de599df9b Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Thu, 13 Apr 2017 19:36:52 +0200 Subject: [PATCH 37/51] [Debug] Set exit status to 255 on error --- src/Symfony/Component/Debug/ErrorHandler.php | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/Debug/ErrorHandler.php b/src/Symfony/Component/Debug/ErrorHandler.php index 78dfba19b1f2c..46bcc33f67f57 100644 --- a/src/Symfony/Component/Debug/ErrorHandler.php +++ b/src/Symfony/Component/Debug/ErrorHandler.php @@ -101,6 +101,7 @@ class ErrorHandler private static $reservedMemory; private static $stackedErrors = array(); private static $stackedErrorLevels = array(); + private static $exitCode = 0; /** * Same init value as thrownErrors. @@ -477,6 +478,9 @@ public function handleError($type, $message, $file, $line) */ public function handleException($exception, array $error = null) { + if (null === $error) { + self::$exitCode = 255; + } if (!$exception instanceof \Exception) { $exception = new FatalThrowableError($exception); } @@ -562,7 +566,7 @@ public static function handleFatalError(array $error = null) return; } - if (null === $error) { + if ($exit = null === $error) { $error = error_get_last(); } @@ -586,15 +590,21 @@ public static function handleFatalError(array $error = null) } else { $exception = new FatalErrorException($handler->levels[$error['type']].': '.$error['message'], 0, $error['type'], $error['file'], $error['line'], 2, true, $trace); } - } elseif (!isset($exception)) { - return; } try { - $handler->handleException($exception, $error); + if (isset($exception)) { + self::$exitCode = 255; + $handler->handleException($exception, $error); + } } catch (FatalErrorException $e) { // Ignore this re-throw } + + if ($exit && self::$exitCode) { + $exitCode = self::$exitCode; + register_shutdown_function('register_shutdown_function', function () use ($exitCode) { exit($exitCode); }); + } } /** From 28332afb38a63d018295a602ad98d2284562a403 Mon Sep 17 00:00:00 2001 From: Dany Maillard Date: Thu, 13 Apr 2017 23:07:15 +0200 Subject: [PATCH 38/51] Add trhows PHPDoc in Application::run --- src/Symfony/Component/Console/Application.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Symfony/Component/Console/Application.php b/src/Symfony/Component/Console/Application.php index bc5e9ee66c09b..f9b90d56a36d6 100644 --- a/src/Symfony/Component/Console/Application.php +++ b/src/Symfony/Component/Console/Application.php @@ -103,6 +103,8 @@ public function setDispatcher(EventDispatcherInterface $dispatcher) * @param OutputInterface $output An Output instance * * @return int 0 if everything went fine, or an error code + * + * @throws \Exception When running fails. Bypass this when {@link setCatchExceptions()}. */ public function run(InputInterface $input = null, OutputInterface $output = null) { From 6d6b04ae977d322213a4ac1bd1c84bfd32313611 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Fri, 14 Apr 2017 09:18:56 +0200 Subject: [PATCH 39/51] [Console] Fix dispatching throwables from ConsoleEvents::COMMAND --- src/Symfony/Component/Console/Application.php | 62 ++++++------- .../Console/Tests/ApplicationTest.php | 87 +++++++++++-------- 2 files changed, 85 insertions(+), 64 deletions(-) diff --git a/src/Symfony/Component/Console/Application.php b/src/Symfony/Component/Console/Application.php index bc5e9ee66c09b..3cc8f24ea814e 100644 --- a/src/Symfony/Component/Console/Application.php +++ b/src/Symfony/Component/Console/Application.php @@ -117,10 +117,17 @@ public function run(InputInterface $input = null, OutputInterface $output = null $this->configureIO($input, $output); try { + $e = null; $exitCode = $this->doRun($input, $output); - } catch (\Exception $e) { + } catch (\Exception $x) { + $e = $x; + } catch (\Throwable $x) { + $e = new FatalThrowableError($x); + } + + if (null !== $e) { if (!$this->catchExceptions) { - throw $e; + throw $x; } if ($output instanceof ConsoleOutputInterface) { @@ -182,6 +189,7 @@ public function doRun(InputInterface $input, OutputInterface $output) $input = new ArrayInput(array('command' => $this->defaultCommand)); } + $this->runningCommand = null; // the command name MUST be the first element of the input $command = $this->find($name); @@ -839,47 +847,41 @@ protected function doRunCommand(Command $command, InputInterface $input, OutputI } if (null === $this->dispatcher) { - try { - return $command->run($input, $output); - } catch (\Exception $e) { - throw $e; - } catch (\Throwable $e) { - throw new FatalThrowableError($e); - } + return $command->run($input, $output); } $event = new ConsoleCommandEvent($command, $input, $output); - $this->dispatcher->dispatch(ConsoleEvents::COMMAND, $event); + $e = null; + + try { + $this->dispatcher->dispatch(ConsoleEvents::COMMAND, $event); - if ($event->commandShouldRun()) { - try { - $e = null; + if ($event->commandShouldRun()) { $exitCode = $command->run($input, $output); - } catch (\Exception $x) { - $e = $x; - } catch (\Throwable $x) { - $e = new FatalThrowableError($x); + } else { + $exitCode = ConsoleCommandEvent::RETURN_CODE_DISABLED; } - if (null !== $e) { - $event = new ConsoleExceptionEvent($command, $input, $output, $e, $e->getCode()); - $this->dispatcher->dispatch(ConsoleEvents::EXCEPTION, $event); - - if ($e !== $event->getException()) { - $x = $e = $event->getException(); - } - - $event = new ConsoleTerminateEvent($command, $input, $output, $e->getCode()); - $this->dispatcher->dispatch(ConsoleEvents::TERMINATE, $event); + } catch (\Exception $e) { + } catch (\Throwable $e) { + } + if (null !== $e) { + $x = $e instanceof \Exception ? $e : new FatalThrowableError($e); + $event = new ConsoleExceptionEvent($command, $input, $output, $x, $x->getCode()); + $this->dispatcher->dispatch(ConsoleEvents::EXCEPTION, $event); - throw $x; + if ($x !== $event->getException()) { + $e = $event->getException(); } - } else { - $exitCode = ConsoleCommandEvent::RETURN_CODE_DISABLED; + $exitCode = $e->getCode(); } $event = new ConsoleTerminateEvent($command, $input, $output, $exitCode); $this->dispatcher->dispatch(ConsoleEvents::TERMINATE, $event); + if (null !== $e) { + throw $e; + } + return $event->getExitCode(); } diff --git a/src/Symfony/Component/Console/Tests/ApplicationTest.php b/src/Symfony/Component/Console/Tests/ApplicationTest.php index df6d1976e7193..5a64c9f164544 100644 --- a/src/Symfony/Component/Console/Tests/ApplicationTest.php +++ b/src/Symfony/Component/Console/Tests/ApplicationTest.php @@ -977,15 +977,28 @@ public function testRunDispatchesAllEventsWithException() $this->assertContains('before.foo.caught.after.', $tester->getDisplay()); } - public function testRunWithError() + public function testRunDispatchesAllEventsWithExceptionInListener() { - if (method_exists($this, 'expectException')) { - $this->expectException('Exception'); - $this->expectExceptionMessage('dymerr'); - } else { - $this->setExpectedException('Exception', 'dymerr'); - } + $dispatcher = $this->getDispatcher(); + $dispatcher->addListener('console.command', function () { + throw new \RuntimeException('foo'); + }); + $application = new Application(); + $application->setDispatcher($dispatcher); + $application->setAutoExit(false); + + $application->register('foo')->setCode(function (InputInterface $input, OutputInterface $output) { + $output->write('foo.'); + }); + + $tester = new ApplicationTester($application); + $tester->run(array('command' => 'foo')); + $this->assertContains('before.caught.after.', $tester->getDisplay()); + } + + public function testRunWithError() + { $application = new Application(); $application->setAutoExit(false); $application->setCatchExceptions(false); @@ -997,7 +1010,13 @@ public function testRunWithError() }); $tester = new ApplicationTester($application); - $tester->run(array('command' => 'dym')); + + try { + $tester->run(array('command' => 'dym')); + $this->fail('Error expected.'); + } catch (\Error $e) { + $this->assertSame('dymerr', $e->getMessage()); + } } /** @@ -1087,32 +1106,6 @@ public function testTerminalDimensions() $this->assertSame(array($width, 80), $application->getTerminalDimensions()); } - protected function getDispatcher($skipCommand = false) - { - $dispatcher = new EventDispatcher(); - $dispatcher->addListener('console.command', function (ConsoleCommandEvent $event) use ($skipCommand) { - $event->getOutput()->write('before.'); - - if ($skipCommand) { - $event->disableCommand(); - } - }); - $dispatcher->addListener('console.terminate', function (ConsoleTerminateEvent $event) use ($skipCommand) { - $event->getOutput()->writeln('after.'); - - if (!$skipCommand) { - $event->setExitCode(113); - } - }); - $dispatcher->addListener('console.exception', function (ConsoleExceptionEvent $event) { - $event->getOutput()->write('caught.'); - - $event->setException(new \LogicException('caught.', $event->getExitCode(), $event->getException())); - }); - - return $dispatcher; - } - public function testSetRunCustomDefaultCommand() { $command = new \FooCommand(); @@ -1151,6 +1144,32 @@ public function testCanCheckIfTerminalIsInteractive() $inputStream = $application->getHelperSet()->get('question')->getInputStream(); $this->assertEquals($tester->getInput()->isInteractive(), @posix_isatty($inputStream)); } + + protected function getDispatcher($skipCommand = false) + { + $dispatcher = new EventDispatcher(); + $dispatcher->addListener('console.command', function (ConsoleCommandEvent $event) use ($skipCommand) { + $event->getOutput()->write('before.'); + + if ($skipCommand) { + $event->disableCommand(); + } + }); + $dispatcher->addListener('console.terminate', function (ConsoleTerminateEvent $event) use ($skipCommand) { + $event->getOutput()->writeln('after.'); + + if (!$skipCommand) { + $event->setExitCode(ConsoleCommandEvent::RETURN_CODE_DISABLED); + } + }); + $dispatcher->addListener('console.exception', function (ConsoleExceptionEvent $event) { + $event->getOutput()->write('caught.'); + + $event->setException(new \LogicException('caught.', $event->getExitCode(), $event->getException())); + }); + + return $dispatcher; + } } class CustomApplication extends Application From 7a9b086d569bf1a20940af887389e582aceb7c18 Mon Sep 17 00:00:00 2001 From: Dany Maillard Date: Mon, 3 Apr 2017 13:58:31 +0200 Subject: [PATCH 40/51] Fold Travis CI output by component --- .github/travis_fold.sh | 16 ++++++++++++++++ .travis.yml | 12 ++++++------ .../DataCollector/DoctrineDataCollectorTest.php | 1 + 3 files changed, 23 insertions(+), 6 deletions(-) create mode 100755 .github/travis_fold.sh diff --git a/.github/travis_fold.sh b/.github/travis_fold.sh new file mode 100755 index 0000000000000..d0430aec58428 --- /dev/null +++ b/.github/travis_fold.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +####################################### +# Fold Travis CI output +# Arguments: +# $1 fold name +# $2 command to execute +####################################### +tfold () { + FOLD=$(echo $1 | tr / .) + echo "travis_fold:start:$FOLD" + echo -e "\\e[34m$1\\e[0m" + sh -c "$2" && echo "travis_fold:end:$FOLD" +} + +export -f tfold diff --git a/.travis.yml b/.travis.yml index 7205200d85e1d..fe6e2f8ce89ef 100644 --- a/.travis.yml +++ b/.travis.yml @@ -82,13 +82,13 @@ install: - if [[ ! $skip ]]; then composer update --no-suggest; fi - if [[ ! $skip ]]; then ./phpunit install; fi - if [[ ! $skip && ! $PHP = hhvm* ]]; then php -i; else hhvm --php -r 'print_r($_SERVER);print_r(ini_get_all());'; fi + - . .github/travis_fold.sh script: - - REPORT=' && echo -e "\\e[32mOK\\e[0m {}\\n\\n" || (echo -e "\\e[41mKO\\e[0m {}\\n\\n" && $(exit 1))' - if [[ $skip ]]; then echo -e "\\n\\e[1;34mIntermediate PHP version $PHP is skipped for pull requests.\\e[0m"; fi - - if [[ ! $deps && ! $PHP = hhvm* ]]; then echo "$COMPONENTS" | parallel --gnu '$PHPUNIT --exclude-group tty,benchmark,intl-data {}'"$REPORT"; fi - - if [[ ! $deps && ! $PHP = hhvm* ]]; then echo -e "\\nRunning tests requiring tty"; $PHPUNIT --group tty; fi + - if [[ ! $deps && ! $PHP = hhvm* ]]; then echo "$COMPONENTS" | parallel --gnu -k 'tfold {}.PHPUnit "$PHPUNIT --exclude-group tty,benchmark,intl-data {}"'; fi + - if [[ ! $deps && ! $PHP = hhvm* ]]; then tfold PHPUnit.tty "$PHPUNIT --group tty"; fi - if [[ ! $deps && $PHP = hhvm* ]]; then $PHPUNIT --exclude-group benchmark,intl-data; fi - - if [[ ! $deps && $PHP = ${MIN_PHP%.*} ]]; then echo -e "1\\n0" | xargs -I{} sh -c 'echo "\\nPHP --enable-sigchild enhanced={}" && ENHANCE_SIGCHLD={} php-$MIN_PHP/sapi/cli/php .phpunit/phpunit-4.8/phpunit --colors=always src/Symfony/Component/Process/'; fi - - if [[ $deps = high ]]; then echo "$COMPONENTS" | parallel --gnu -j10% 'cd {}; composer update --no-progress --no-suggest --ansi; $PHPUNIT --exclude-group tty,benchmark,intl-data'$LEGACY"$REPORT"; fi - - if [[ $deps = low ]]; then echo "$COMPONENTS" | parallel --gnu -j10% 'cd {}; composer update --no-progress --no-suggest --ansi --prefer-lowest --prefer-stable; $PHPUNIT --exclude-group tty,benchmark,intl-data'"$REPORT"; fi + - if [[ ! $deps && $PHP = ${MIN_PHP%.*} ]]; then echo -e "1\\n0" | xargs -I{} sh -c 'tfold PHPUnit.sigchild "ENHANCE_SIGCHLD={} php-$MIN_PHP/sapi/cli/php .phpunit/phpunit-4.8/phpunit --colors=always src/Symfony/Component/Process/"'; fi + - if [[ $deps = high ]]; then echo "$COMPONENTS" | parallel --gnu -k -j10% 'cd {}; tfold {}.composer "composer update --no-progress --no-suggest --ansi 2>&1"; tfold {}.PHPUnit "$PHPUNIT --exclude-group tty,benchmark,intl-data$LEGACY"'; fi + - if [[ $deps = low ]]; then echo "$COMPONENTS" | parallel --gnu -k -j10% 'cd {}; tfold {}.composer "composer update --no-progress --no-suggest --ansi --prefer-lowest --prefer-stable 2>&1"; tfold {}.PHPUnit "$PHPUNIT --exclude-group tty,benchmark,intl-data"'; fi diff --git a/src/Symfony/Bridge/Doctrine/Tests/DataCollector/DoctrineDataCollectorTest.php b/src/Symfony/Bridge/Doctrine/Tests/DataCollector/DoctrineDataCollectorTest.php index 3059f8aba00a3..cf5cee90dd5cb 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/DataCollector/DoctrineDataCollectorTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/DataCollector/DoctrineDataCollectorTest.php @@ -24,6 +24,7 @@ public function testCollectConnections() $c = $this->createCollector(array()); $c->collect(new Request(), new Response()); $this->assertEquals(array('default' => 'doctrine.dbal.default_connection'), $c->getConnections()); + $this->assertTrue(false); } public function testCollectManagers() From cf87678a2e6aa6249b2c8a38ef0ab151ae787e74 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 18 Apr 2017 17:01:04 +0200 Subject: [PATCH 41/51] Make .travis.yml more readable --- .github/travis_fold.sh | 16 -- .travis.yml | 166 +++++++++++++----- .../DoctrineDataCollectorTest.php | 1 - 3 files changed, 119 insertions(+), 64 deletions(-) delete mode 100755 .github/travis_fold.sh diff --git a/.github/travis_fold.sh b/.github/travis_fold.sh deleted file mode 100755 index d0430aec58428..0000000000000 --- a/.github/travis_fold.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -####################################### -# Fold Travis CI output -# Arguments: -# $1 fold name -# $2 command to execute -####################################### -tfold () { - FOLD=$(echo $1 | tr / .) - echo "travis_fold:start:$FOLD" - echo -e "\\e[34m$1\\e[0m" - sh -c "$2" && echo "travis_fold:end:$FOLD" -} - -export -f tfold diff --git a/.travis.yml b/.travis.yml index fe6e2f8ce89ef..e33ea4d8764db 100644 --- a/.travis.yml +++ b/.travis.yml @@ -40,55 +40,127 @@ cache: services: mongodb before_install: - - stty cols 120 - - PHP=$TRAVIS_PHP_VERSION - # Matrix lines for intermediate PHP versions are skipped for pull requests - - if [[ ! $deps && ! $PHP = ${MIN_PHP%.*} && ! $PHP = hhvm* && $TRAVIS_PULL_REQUEST != false ]]; then deps=skip; skip=1; fi - # A sigchild-enabled-PHP is used to test the Process component on the lowest PHP matrix line - - if [[ ! $deps && $PHP = ${MIN_PHP%.*} && ! -d php-$MIN_PHP/sapi ]]; then wget http://museum.php.net/php5/php-$MIN_PHP.tar.bz2 -O - | tar -xj; (cd php-$MIN_PHP; ./configure --enable-sigchild --enable-pcntl; make -j2); fi - - if [[ ! $PHP = hhvm* ]]; then INI_FILE=~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini; else INI_FILE=/etc/hhvm/php.ini; fi - - if [[ ! $skip ]]; then echo date.timezone = Europe/Paris >> $INI_FILE; fi - - if [[ ! $skip ]]; then echo memory_limit = -1 >> $INI_FILE; fi - - if [[ ! $skip ]]; then echo session.gc_probability = 0 >> $INI_FILE; fi - - if [[ ! $skip ]]; then echo opcache.enable_cli = 1 >> $INI_FILE; fi - - if [[ ! $skip ]]; then echo hhvm.jit = 0 >> $INI_FILE; fi - - if [[ ! $skip && $PHP = 5.* ]]; then echo extension = mongo.so >> $INI_FILE; fi - - if [[ ! $skip && $PHP = 5.* ]]; then echo extension = memcache.so >> $INI_FILE; fi - - if [[ ! $skip && $PHP = 5.* ]]; then (echo yes | pecl install -f apcu-4.0.11 && echo apc.enable_cli = 1 >> $INI_FILE); fi - - if [[ ! $skip && $PHP = 7.* ]]; then (echo yes | pecl install -f apcu-5.1.6 && echo apc.enable_cli = 1 >> $INI_FILE); fi - - if [[ ! $deps && $PHP = 5.* ]]; then (cd src/Symfony/Component/Debug/Resources/ext && phpize && ./configure && make && echo extension = $(pwd)/modules/symfony_debug.so >> $INI_FILE); fi - - if [[ ! $skip && $PHP = 5.* ]]; then pecl install -f memcached-2.1.0; fi - - if [[ ! $skip && ! $PHP = hhvm* ]]; then echo extension = ldap.so >> $INI_FILE; fi - - if [[ ! $skip && ! $PHP = hhvm* ]]; then phpenv config-rm xdebug.ini || echo "xdebug not available"; fi - - if [[ ! $skip ]]; then [ -d ~/.composer ] || mkdir ~/.composer; cp .composer/* ~/.composer/; fi - - if [[ ! $skip ]]; then export PHPUNIT=$(readlink -f ./phpunit); fi + - | + # General configuration + stty cols 120 + PHP=$TRAVIS_PHP_VERSION + [ -d ~/.composer ] || mkdir ~/.composer + cp .composer/* ~/.composer/ + export PHPUNIT=$(readlink -f ./phpunit) + export PHPUNIT_X="$PHPUNIT --exclude-group tty,benchmark,intl-data" + export COMPOSER_UP='composer update --no-progress --no-suggest --ansi' + + # tfold is a helper to create folded reports + tfold () { + title=$1 + fold=$(echo $title | sed -r 's/[^-_A-Za-z\d]+/./g') + shift + echo -e "travis_fold:start:$fold\\n\\e[1;34m$title\\e[0m" + bash -xc "$*" 2>&1 && + echo -e "\\e[32mOK\\e[0m $title\\n\\ntravis_fold:end:$fold" || + ( echo -e "\\e[41mKO\\e[0m $title\\n" && exit 1 ) + } + export -f tfold + + # php.ini configuration + if [[ $PHP = hhvm* ]]; then + INI=/etc/hhvm/php.ini + else + INI=~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini + phpenv config-rm xdebug.ini || echo "xdebug not available" + fi + echo date.timezone = Europe/Paris >> $INI + echo memory_limit = -1 >> $INI + echo session.gc_probability = 0 >> $INI + echo opcache.enable_cli = 1 >> $INI + echo hhvm.jit = 0 >> $INI + echo apc.enable_cli = 1 >> $INI + echo extension = ldap.so >> $INI + [[ $PHP = 5.* ]] && echo extension = mongo.so >> $INI + [[ $PHP = 5.* ]] && echo extension = memcache.so >> $INI + + # Matrix lines for intermediate PHP versions are skipped for pull requests + if [[ ! $deps && ! $PHP = ${MIN_PHP%.*} && ! $PHP = hhvm* && $TRAVIS_PULL_REQUEST != false ]]; then + deps=skip + skip=1 + else + COMPONENTS=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -printf '%h\n') + fi + + - | + # Install sigchild-enabled PHP to test the Process component on the lowest PHP matrix line + if [[ ! $deps && $PHP = ${MIN_PHP%.*} && ! -d php-$MIN_PHP/sapi ]]; then + wget http://museum.php.net/php5/php-$MIN_PHP.tar.bz2 -O - | tar -xj && + (cd php-$MIN_PHP && ./configure --enable-sigchild --enable-pcntl && make -j2) + fi + + - | + # Install extra PHP extensions + if [[ ! $skip && $PHP = 5.* ]]; then + ([[ $deps ]] || tfold ext.symfony_debug 'cd src/Symfony/Component/Debug/Resources/ext && phpize && ./configure && make && echo extension = $(pwd)/modules/symfony_debug.so >> '"$INI") && + tfold ext.memcached pecl install -f memcached-2.1.0 && + tfold ext.apcu4 'echo yes | pecl install -f apcu-4.0.11' + elif [[ ! $skip && $PHP = 7.* ]]; then + tfold ext.apcu5 'echo yes | pecl install -f apcu-5.1.6' + fi install: - - if [[ ! $skip && $deps ]]; then cp composer.json composer.json.orig; fi - - if [[ ! $skip && $deps ]]; then echo -e '{\n"require":{'"$(grep phpunit-bridge composer.json)"'"php":"*"},"minimum-stability":"dev"}' > composer.json; fi - - if [[ ! $skip ]]; then COMPONENTS=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -printf '%h\n'); fi - # Create local composer packages for each patched components and reference them in composer.json files when cross-testing components - - if [[ ! $skip && $deps ]]; then php .github/build-packages.php HEAD^ $COMPONENTS; fi - - if [[ ! $skip && $deps ]]; then mv composer.json composer.json.phpunit; mv composer.json.orig composer.json; fi - - if [[ ! $skip && ! $deps ]]; then php .github/build-packages.php HEAD^ src/Symfony/Bridge/PhpUnit; fi - # For the master branch when deps=high, the version before master is checked out and tested with the locally patched components - - if [[ $deps = high && $TRAVIS_BRANCH = master ]]; then SYMFONY_VERSION=$(git ls-remote --heads | grep -o '/[1-9].*' | tail -n 1 | sed s/.//); else SYMFONY_VERSION=$(cat composer.json | grep '^ *"dev-master". *"[1-9]' | grep -o '[0-9.]*'); fi - - if [[ $deps = high && $TRAVIS_BRANCH = master ]]; then git fetch origin $SYMFONY_VERSION; git checkout -m FETCH_HEAD; COMPONENTS=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -printf '%h\n'); fi - # Legacy tests are skipped when deps=high and when the current branch version has not the same major version number than the next one - - if [[ $deps = high && ${SYMFONY_VERSION%.*} != $(git show $(git ls-remote --heads | grep -FA1 /$SYMFONY_VERSION | tail -n 1):composer.json | grep '^ *"dev-master". *"[1-9]' | grep -o '[0-9]*' | head -n 1) ]]; then LEGACY=,legacy; fi - - export COMPOSER_ROOT_VERSION=$SYMFONY_VERSION.x-dev - - if [[ ! $skip && $deps ]]; then export SYMFONY_DEPRECATIONS_HELPER=weak; fi - - if [[ ! $skip && $deps ]]; then mv composer.json.phpunit composer.json; fi - - if [[ ! $skip ]]; then composer update --no-suggest; fi + - | + # Create local composer packages for each patched components and reference them in composer.json files when cross-testing components + if [[ ! $deps ]]; then + php .github/build-packages.php HEAD^ src/Symfony/Bridge/PhpUnit + elif [[ ! $skip ]]; then + export SYMFONY_DEPRECATIONS_HELPER=weak && + cp composer.json composer.json.orig && + echo -e '{\n"require":{'"$(grep phpunit-bridge composer.json)"'"php":"*"},"minimum-stability":"dev"}' > composer.json && + php .github/build-packages.php HEAD^ $COMPONENTS && + mv composer.json composer.json.phpunit && + mv composer.json.orig composer.json + fi + + - | + # For the master branch, when deps=high, the version before master is checked out and tested with the locally patched components + if [[ $deps = high && $TRAVIS_BRANCH = master ]]; then + SYMFONY_VERSION=$(git ls-remote --heads | grep -o '/[1-9].*' | tail -n 1 | sed s/.//) && + git fetch origin $SYMFONY_VERSION && + git checkout -m FETCH_HEAD && + COMPONENTS=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -printf '%h\n') + elif [[ ! $skip ]]; then + SYMFONY_VERSION=$(cat composer.json | grep '^ *"dev-master". *"[1-9]' | grep -o '[0-9.]*') + fi + + - | + # Legacy tests are skipped when deps=high and when the current branch version has not the same major version number than the next one + [[ $deps = high && ${SYMFONY_VERSION%.*} != $(git show $(git ls-remote --heads | grep -FA1 /$SYMFONY_VERSION | tail -n 1):composer.json | grep '^ *"dev-master". *"[1-9]' | grep -o '[0-9]*' | head -n 1) ]] && LEGACY=,legacy + + export COMPOSER_ROOT_VERSION=$SYMFONY_VERSION.x-dev + if [[ ! $skip && $deps ]]; then mv composer.json.phpunit composer.json; fi + + - if [[ ! $skip ]]; then $COMPOSER_UP; fi - if [[ ! $skip ]]; then ./phpunit install; fi - - if [[ ! $skip && ! $PHP = hhvm* ]]; then php -i; else hhvm --php -r 'print_r($_SERVER);print_r(ini_get_all());'; fi - - . .github/travis_fold.sh + - | + # phpinfo + if [[ ! $PHP = hhvm* ]]; then php -i; else hhvm --php -r 'print_r($_SERVER);print_r(ini_get_all());'; fi + + - | + run_tests () { + set -e + if [[ $skip ]]; then + echo -e "\\n\\e[1;34mIntermediate PHP version $PHP is skipped for pull requests.\\e[0m" + elif [[ $deps = high ]]; then + echo "$COMPONENTS" | parallel --gnu -j10% "tfold {} 'cd {} && $COMPOSER_UP && $PHPUNIT_X$LEGACY'" + elif [[ $deps = low ]]; then + echo "$COMPONENTS" | parallel --gnu -j10% "tfold {} 'cd {} && $COMPOSER_UP --prefer-lowest --prefer-stable && $PHPUNIT_X'" + elif [[ $PHP = hhvm* ]]; then + $PHPUNIT --exclude-group benchmark,intl-data + else + echo "$COMPONENTS" | parallel --gnu "tfold {} $PHPUNIT_X {}" + tfold tty-group $PHPUNIT --group tty + if [[ $PHP = ${MIN_PHP%.*} ]]; then + echo -e "1\\n0" | xargs -I{} bash -c "tfold src/Symfony/Component/Process.sigchild{} ENHANCE_SIGCHLD={} php-$MIN_PHP/sapi/cli/php .phpunit/phpunit-4.8/phpunit --colors=always src/Symfony/Component/Process/" + fi + fi + } script: - - if [[ $skip ]]; then echo -e "\\n\\e[1;34mIntermediate PHP version $PHP is skipped for pull requests.\\e[0m"; fi - - if [[ ! $deps && ! $PHP = hhvm* ]]; then echo "$COMPONENTS" | parallel --gnu -k 'tfold {}.PHPUnit "$PHPUNIT --exclude-group tty,benchmark,intl-data {}"'; fi - - if [[ ! $deps && ! $PHP = hhvm* ]]; then tfold PHPUnit.tty "$PHPUNIT --group tty"; fi - - if [[ ! $deps && $PHP = hhvm* ]]; then $PHPUNIT --exclude-group benchmark,intl-data; fi - - if [[ ! $deps && $PHP = ${MIN_PHP%.*} ]]; then echo -e "1\\n0" | xargs -I{} sh -c 'tfold PHPUnit.sigchild "ENHANCE_SIGCHLD={} php-$MIN_PHP/sapi/cli/php .phpunit/phpunit-4.8/phpunit --colors=always src/Symfony/Component/Process/"'; fi - - if [[ $deps = high ]]; then echo "$COMPONENTS" | parallel --gnu -k -j10% 'cd {}; tfold {}.composer "composer update --no-progress --no-suggest --ansi 2>&1"; tfold {}.PHPUnit "$PHPUNIT --exclude-group tty,benchmark,intl-data$LEGACY"'; fi - - if [[ $deps = low ]]; then echo "$COMPONENTS" | parallel --gnu -k -j10% 'cd {}; tfold {}.composer "composer update --no-progress --no-suggest --ansi --prefer-lowest --prefer-stable 2>&1"; tfold {}.PHPUnit "$PHPUNIT --exclude-group tty,benchmark,intl-data"'; fi + - (run_tests) diff --git a/src/Symfony/Bridge/Doctrine/Tests/DataCollector/DoctrineDataCollectorTest.php b/src/Symfony/Bridge/Doctrine/Tests/DataCollector/DoctrineDataCollectorTest.php index cf5cee90dd5cb..3059f8aba00a3 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/DataCollector/DoctrineDataCollectorTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/DataCollector/DoctrineDataCollectorTest.php @@ -24,7 +24,6 @@ public function testCollectConnections() $c = $this->createCollector(array()); $c->collect(new Request(), new Response()); $this->assertEquals(array('default' => 'doctrine.dbal.default_connection'), $c->getConnections()); - $this->assertTrue(false); } public function testCollectManagers() From 1eeadb0c98164d44223ecc490ddf0623756f099a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Wed, 19 Apr 2017 22:37:09 +0200 Subject: [PATCH 42/51] [Serializer] XmlEncoder: fix negative int and large numbers handling --- .../Serializer/Encoder/XmlEncoder.php | 14 +++++-- .../Tests/Encoder/XmlEncoderTest.php | 40 +++++++++++++++++++ 2 files changed, 51 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php b/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php index 40f61167b3698..2cd5bbd521e0b 100644 --- a/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php +++ b/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php @@ -301,11 +301,19 @@ private function parseXmlAttributes(\DOMNode $node) $data = array(); foreach ($node->attributes as $attr) { - if (ctype_digit($attr->nodeValue)) { - $data['@'.$attr->nodeName] = (int) $attr->nodeValue; - } else { + if (!is_numeric($attr->nodeValue)) { $data['@'.$attr->nodeName] = $attr->nodeValue; + + continue; + } + + if (false !== $val = filter_var($attr->nodeValue, FILTER_VALIDATE_INT)) { + $data['@'.$attr->nodeName] = $val; + + continue; } + + $data['@'.$attr->nodeName] = (float) $attr->nodeValue; } return $data; diff --git a/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php b/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php index e036fbbaf486b..b8ec8fd0d674d 100644 --- a/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php +++ b/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php @@ -222,6 +222,46 @@ public function testDecodeScalar() $this->assertEquals('foo', $this->encoder->decode($source, 'xml')); } + public function testDecodeBigDigitAttributes() + { + $source = << +Name +XML; + + $this->assertSame(array('@index' => 182077241760011681341821060401202210011000045913000000017100, '#' => 'Name'), $this->encoder->decode($source, 'xml')); + } + + public function testDecodeNegativeIntAttribute() + { + $source = << +Name +XML; + + $this->assertSame(array('@index' => -1234, '#' => 'Name'), $this->encoder->decode($source, 'xml')); + } + + public function testDecodeFloatAttribute() + { + $source = << +Name +XML; + + $this->assertSame(array('@index' => -12.11, '#' => 'Name'), $this->encoder->decode($source, 'xml')); + } + + public function testDecodeNegativeFloatAttribute() + { + $source = << +Name +XML; + + $this->assertSame(array('@index' => -12.11, '#' => 'Name'), $this->encoder->decode($source, 'xml')); + } + public function testEncode() { $source = $this->getXmlSource(); From 5cabf880d62e6fe80158e318ddf1f8e3e9c8b1ea Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Fri, 21 Apr 2017 13:48:46 +0200 Subject: [PATCH 43/51] [DI] Add missing check in PhpDumper --- .../Component/DependencyInjection/Dumper/PhpDumper.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php index cabcbcd657ac0..de910517c8d23 100644 --- a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php +++ b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php @@ -1331,9 +1331,12 @@ private function dumpValue($value, $interpolate = true) if (null !== $this->definitionVariables && $this->definitionVariables->contains($value)) { return $this->dumpValue($this->definitionVariables->offsetGet($value), $interpolate); } - if (count($value->getMethodCalls()) > 0) { + if ($value->getMethodCalls()) { throw new RuntimeException('Cannot dump definitions which have method calls.'); } + if ($value->getProperties()) { + throw new RuntimeException('Cannot dump definitions which have properties.'); + } if (null !== $value->getConfigurator()) { throw new RuntimeException('Cannot dump definitions which have a configurator.'); } From 746c91eea42ee4799b6ffeb2b4aada531e430b47 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Tue, 25 Apr 2017 21:08:25 -0400 Subject: [PATCH 44/51] Preventing the base path or absolute URL from being prefixed incorrectly on an absolute URL If the version strategy returns an absolute URL, that should be the final URL. --- src/Symfony/Component/Asset/PathPackage.php | 8 +++++++- src/Symfony/Component/Asset/Tests/PathPackageTest.php | 11 +++++++++++ src/Symfony/Component/Asset/Tests/UrlPackageTest.php | 11 +++++++++++ src/Symfony/Component/Asset/UrlPackage.php | 4 ++++ 4 files changed, 33 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Asset/PathPackage.php b/src/Symfony/Component/Asset/PathPackage.php index 906879f8b064d..4dcda08e062c4 100644 --- a/src/Symfony/Component/Asset/PathPackage.php +++ b/src/Symfony/Component/Asset/PathPackage.php @@ -56,7 +56,13 @@ public function getUrl($path) return $path; } - return $this->getBasePath().ltrim($this->getVersionStrategy()->applyVersion($path), '/'); + $versionedPath = $this->getVersionStrategy()->applyVersion($path); + + if ($this->isAbsoluteUrl($versionedPath)) { + return $versionedPath; + } + + return $this->getBasePath().ltrim($versionedPath, '/'); } /** diff --git a/src/Symfony/Component/Asset/Tests/PathPackageTest.php b/src/Symfony/Component/Asset/Tests/PathPackageTest.php index 6a7c2cc6e45d8..a1ac26442a066 100644 --- a/src/Symfony/Component/Asset/Tests/PathPackageTest.php +++ b/src/Symfony/Component/Asset/Tests/PathPackageTest.php @@ -75,6 +75,17 @@ public function getContextConfigs() ); } + public function testVersionStrategyGivesAbsoluteURL() + { + $versionStrategy = $this->getMockBuilder('Symfony\Component\Asset\VersionStrategy\VersionStrategyInterface')->getMock(); + $versionStrategy->expects($this->any()) + ->method('applyVersion') + ->willReturn('https://cdn.com/bar/main.css'); + $package = new PathPackage('/subdirectory', $versionStrategy, $this->getContext('/bar')); + + $this->assertEquals('https://cdn.com/bar/main.css', $package->getUrl('main.css')); + } + private function getContext($basePath) { $context = $this->getMockBuilder('Symfony\Component\Asset\Context\ContextInterface')->getMock(); diff --git a/src/Symfony/Component/Asset/Tests/UrlPackageTest.php b/src/Symfony/Component/Asset/Tests/UrlPackageTest.php index 0066834484351..97e7a46d706da 100644 --- a/src/Symfony/Component/Asset/Tests/UrlPackageTest.php +++ b/src/Symfony/Component/Asset/Tests/UrlPackageTest.php @@ -77,6 +77,17 @@ public function getContextConfigs() ); } + public function testVersionStrategyGivesAbsoluteURL() + { + $versionStrategy = $this->getMockBuilder('Symfony\Component\Asset\VersionStrategy\VersionStrategyInterface')->getMock(); + $versionStrategy->expects($this->any()) + ->method('applyVersion') + ->willReturn('https://cdn.com/bar/main.css'); + $package = new UrlPackage('https://example.com', $versionStrategy); + + $this->assertEquals('https://cdn.com/bar/main.css', $package->getUrl('main.css')); + } + /** * @expectedException \Symfony\Component\Asset\Exception\LogicException */ diff --git a/src/Symfony/Component/Asset/UrlPackage.php b/src/Symfony/Component/Asset/UrlPackage.php index de9c1f07d5f5d..782b2ddfce93b 100644 --- a/src/Symfony/Component/Asset/UrlPackage.php +++ b/src/Symfony/Component/Asset/UrlPackage.php @@ -81,6 +81,10 @@ public function getUrl($path) $url = $this->getVersionStrategy()->applyVersion($path); + if ($this->isAbsoluteUrl($url)) { + return $url; + } + if ($url && '/' != $url[0]) { $url = '/'.$url; } From 8ea38b56e060e916489897999708cb77d84b599d Mon Sep 17 00:00:00 2001 From: Maxime Steinhausser Date: Thu, 27 Apr 2017 20:23:38 +0200 Subject: [PATCH 45/51] Fix minor typo in the main README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1ec5983c5ca21..16a7e1b489c4d 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ If you discover a security vulnerability within Symfony, please follow our About Us -------- -Symfony development is sponsored by [SensioLabs][21], lead by the +Symfony development is sponsored by [SensioLabs][21], led by the [Symfony Core Team][22] and supported by [Symfony contributors][19]. [1]: https://symfony.com From e843924c0399101f0894c637f118c6d249224c36 Mon Sep 17 00:00:00 2001 From: Roland Franssen Date: Fri, 28 Apr 2017 15:28:02 +0200 Subject: [PATCH 46/51] [Security] Fix phpdoc logout listener --- .../Firewall/AbstractAuthenticationListener.php | 6 +++--- .../Security/Http/Firewall/LogoutListener.php | 10 +++++----- .../Security/Http/Firewall/RememberMeListener.php | 14 +++++++------- .../Firewall/SimpleFormAuthenticationListener.php | 10 +++++----- .../Firewall/SimplePreAuthenticationListener.php | 4 ++-- 5 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/Symfony/Component/Security/Http/Firewall/AbstractAuthenticationListener.php b/src/Symfony/Component/Security/Http/Firewall/AbstractAuthenticationListener.php index 09a4f558fe749..1eae0948a13c3 100644 --- a/src/Symfony/Component/Security/Http/Firewall/AbstractAuthenticationListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/AbstractAuthenticationListener.php @@ -69,14 +69,14 @@ abstract class AbstractAuthenticationListener implements ListenerInterface * @param TokenStorageInterface $tokenStorage A TokenStorageInterface instance * @param AuthenticationManagerInterface $authenticationManager An AuthenticationManagerInterface instance * @param SessionAuthenticationStrategyInterface $sessionStrategy - * @param HttpUtils $httpUtils An HttpUtilsInterface instance + * @param HttpUtils $httpUtils An HttpUtils instance * @param string $providerKey * @param AuthenticationSuccessHandlerInterface $successHandler * @param AuthenticationFailureHandlerInterface $failureHandler * @param array $options An array of options for the processing of a * successful, or failed authentication attempt - * @param LoggerInterface $logger A LoggerInterface instance - * @param EventDispatcherInterface $dispatcher An EventDispatcherInterface instance + * @param LoggerInterface|null $logger A LoggerInterface instance + * @param EventDispatcherInterface|null $dispatcher An EventDispatcherInterface instance * * @throws \InvalidArgumentException */ diff --git a/src/Symfony/Component/Security/Http/Firewall/LogoutListener.php b/src/Symfony/Component/Security/Http/Firewall/LogoutListener.php index 96f568534d3de..01e3be722fbd0 100644 --- a/src/Symfony/Component/Security/Http/Firewall/LogoutListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/LogoutListener.php @@ -42,11 +42,11 @@ class LogoutListener implements ListenerInterface /** * Constructor. * - * @param TokenStorageInterface $tokenStorage - * @param HttpUtils $httpUtils An HttpUtilsInterface instance - * @param LogoutSuccessHandlerInterface $successHandler A LogoutSuccessHandlerInterface instance - * @param array $options An array of options to process a logout attempt - * @param CsrfTokenManagerInterface $csrfTokenManager A CsrfTokenManagerInterface instance + * @param TokenStorageInterface $tokenStorage + * @param HttpUtils $httpUtils An HttpUtils instance + * @param LogoutSuccessHandlerInterface $successHandler A LogoutSuccessHandlerInterface instance + * @param array $options An array of options to process a logout attempt + * @param CsrfTokenManagerInterface|null $csrfTokenManager A CsrfTokenManagerInterface instance */ public function __construct(TokenStorageInterface $tokenStorage, HttpUtils $httpUtils, LogoutSuccessHandlerInterface $successHandler, array $options = array(), $csrfTokenManager = null) { diff --git a/src/Symfony/Component/Security/Http/Firewall/RememberMeListener.php b/src/Symfony/Component/Security/Http/Firewall/RememberMeListener.php index 4186430708910..bc859f9f5dce4 100644 --- a/src/Symfony/Component/Security/Http/Firewall/RememberMeListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/RememberMeListener.php @@ -41,13 +41,13 @@ class RememberMeListener implements ListenerInterface /** * Constructor. * - * @param TokenStorageInterface $tokenStorage - * @param RememberMeServicesInterface $rememberMeServices - * @param AuthenticationManagerInterface $authenticationManager - * @param LoggerInterface $logger - * @param EventDispatcherInterface $dispatcher - * @param bool $catchExceptions - * @param SessionAuthenticationStrategyInterface $sessionStrategy + * @param TokenStorageInterface $tokenStorage + * @param RememberMeServicesInterface $rememberMeServices + * @param AuthenticationManagerInterface $authenticationManager + * @param LoggerInterface|null $logger + * @param EventDispatcherInterface|null $dispatcher + * @param bool $catchExceptions + * @param SessionAuthenticationStrategyInterface|null $sessionStrategy */ public function __construct(TokenStorageInterface $tokenStorage, RememberMeServicesInterface $rememberMeServices, AuthenticationManagerInterface $authenticationManager, LoggerInterface $logger = null, EventDispatcherInterface $dispatcher = null, $catchExceptions = true, SessionAuthenticationStrategyInterface $sessionStrategy = null) { diff --git a/src/Symfony/Component/Security/Http/Firewall/SimpleFormAuthenticationListener.php b/src/Symfony/Component/Security/Http/Firewall/SimpleFormAuthenticationListener.php index 8123e0e22e7b5..d97a3427138b3 100644 --- a/src/Symfony/Component/Security/Http/Firewall/SimpleFormAuthenticationListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/SimpleFormAuthenticationListener.php @@ -44,16 +44,16 @@ class SimpleFormAuthenticationListener extends AbstractAuthenticationListener * @param TokenStorageInterface $tokenStorage A TokenStorageInterface instance * @param AuthenticationManagerInterface $authenticationManager An AuthenticationManagerInterface instance * @param SessionAuthenticationStrategyInterface $sessionStrategy - * @param HttpUtils $httpUtils An HttpUtilsInterface instance + * @param HttpUtils $httpUtils An HttpUtils instance * @param string $providerKey * @param AuthenticationSuccessHandlerInterface $successHandler * @param AuthenticationFailureHandlerInterface $failureHandler * @param array $options An array of options for the processing of a * successful, or failed authentication attempt - * @param LoggerInterface $logger A LoggerInterface instance - * @param EventDispatcherInterface $dispatcher An EventDispatcherInterface instance - * @param CsrfTokenManagerInterface $csrfTokenManager A CsrfTokenManagerInterface instance - * @param SimpleFormAuthenticatorInterface $simpleAuthenticator A SimpleFormAuthenticatorInterface instance + * @param LoggerInterface|null $logger A LoggerInterface instance + * @param EventDispatcherInterface|null $dispatcher An EventDispatcherInterface instance + * @param CsrfTokenManagerInterface|null $csrfTokenManager A CsrfTokenManagerInterface instance + * @param SimpleFormAuthenticatorInterface|null $simpleAuthenticator A SimpleFormAuthenticatorInterface instance * * @throws \InvalidArgumentException In case no simple authenticator is provided * @throws InvalidArgumentException In case an invalid CSRF token manager is passed diff --git a/src/Symfony/Component/Security/Http/Firewall/SimplePreAuthenticationListener.php b/src/Symfony/Component/Security/Http/Firewall/SimplePreAuthenticationListener.php index 8f1f6fdce5a60..7f85a1ec7bd8f 100644 --- a/src/Symfony/Component/Security/Http/Firewall/SimplePreAuthenticationListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/SimplePreAuthenticationListener.php @@ -46,8 +46,8 @@ class SimplePreAuthenticationListener implements ListenerInterface * @param AuthenticationManagerInterface $authenticationManager An AuthenticationManagerInterface instance * @param string $providerKey * @param SimplePreAuthenticatorInterface $simpleAuthenticator A SimplePreAuthenticatorInterface instance - * @param LoggerInterface $logger A LoggerInterface instance - * @param EventDispatcherInterface $dispatcher An EventDispatcherInterface instance + * @param LoggerInterface|null $logger A LoggerInterface instance + * @param EventDispatcherInterface|null $dispatcher An EventDispatcherInterface instance */ public function __construct(TokenStorageInterface $tokenStorage, AuthenticationManagerInterface $authenticationManager, $providerKey, SimplePreAuthenticatorInterface $simpleAuthenticator, LoggerInterface $logger = null, EventDispatcherInterface $dispatcher = null) { From 3cc096b540be13f258283aa8aa7b4a6a130cee5e Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Tue, 25 Apr 2017 21:36:30 -0400 Subject: [PATCH 47/51] [Asset] Starting slash should indicate no basePath wanted --- src/Symfony/Component/Asset/PathPackage.php | 3 +- .../Component/Asset/Tests/PathPackageTest.php | 42 +++++++++---------- 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/src/Symfony/Component/Asset/PathPackage.php b/src/Symfony/Component/Asset/PathPackage.php index 4dcda08e062c4..5621986fb58b6 100644 --- a/src/Symfony/Component/Asset/PathPackage.php +++ b/src/Symfony/Component/Asset/PathPackage.php @@ -58,7 +58,8 @@ public function getUrl($path) $versionedPath = $this->getVersionStrategy()->applyVersion($path); - if ($this->isAbsoluteUrl($versionedPath)) { + // if absolute or begins with /, we're done + if ($this->isAbsoluteUrl($versionedPath) || ($versionedPath && '/' === $versionedPath[0])) { return $versionedPath; } diff --git a/src/Symfony/Component/Asset/Tests/PathPackageTest.php b/src/Symfony/Component/Asset/Tests/PathPackageTest.php index a1ac26442a066..4a9f90df90a11 100644 --- a/src/Symfony/Component/Asset/Tests/PathPackageTest.php +++ b/src/Symfony/Component/Asset/Tests/PathPackageTest.php @@ -35,16 +35,16 @@ public function getConfigs() array('', '', '/foo', '/foo?v1'), - array('/foo', '', '/foo', '/foo/foo?v1'), - array('/foo', '', 'foo', '/foo/foo?v1'), - array('foo', '', 'foo', '/foo/foo?v1'), - array('foo/', '', 'foo', '/foo/foo?v1'), - array('/foo/', '', 'foo', '/foo/foo?v1'), - - array('/foo', 'version-%2$s/%1$s', '/foo', '/foo/version-v1/foo'), - array('/foo', 'version-%2$s/%1$s', 'foo', '/foo/version-v1/foo'), - array('/foo', 'version-%2$s/%1$s', 'foo/', '/foo/version-v1/foo/'), - array('/foo', 'version-%2$s/%1$s', '/foo/', '/foo/version-v1/foo/'), + array('/foo', '', '/bar', '/bar?v1'), + array('/foo', '', 'bar', '/foo/bar?v1'), + array('foo', '', 'bar', '/foo/bar?v1'), + array('foo/', '', 'bar', '/foo/bar?v1'), + array('/foo/', '', 'bar', '/foo/bar?v1'), + + array('/foo', 'version-%2$s/%1$s', '/bar', '/version-v1/bar'), + array('/foo', 'version-%2$s/%1$s', 'bar', '/foo/version-v1/bar'), + array('/foo', 'version-%2$s/%1$s', 'bar/', '/foo/version-v1/bar/'), + array('/foo', 'version-%2$s/%1$s', '/bar/', '/version-v1/bar/'), ); } @@ -61,17 +61,17 @@ public function testGetUrlWithContext($basePathRequest, $basePath, $format, $pat public function getContextConfigs() { return array( - array('', '/foo', '', '/foo', '/foo/foo?v1'), - array('', '/foo', '', 'foo', '/foo/foo?v1'), - array('', 'foo', '', 'foo', '/foo/foo?v1'), - array('', 'foo/', '', 'foo', '/foo/foo?v1'), - array('', '/foo/', '', 'foo', '/foo/foo?v1'), - - array('/bar', '/foo', '', '/foo', '/bar/foo/foo?v1'), - array('/bar', '/foo', '', 'foo', '/bar/foo/foo?v1'), - array('/bar', 'foo', '', 'foo', '/bar/foo/foo?v1'), - array('/bar', 'foo/', '', 'foo', '/bar/foo/foo?v1'), - array('/bar', '/foo/', '', 'foo', '/bar/foo/foo?v1'), + array('', '/foo', '', '/baz', '/baz?v1'), + array('', '/foo', '', 'baz', '/foo/baz?v1'), + array('', 'foo', '', 'baz', '/foo/baz?v1'), + array('', 'foo/', '', 'baz', '/foo/baz?v1'), + array('', '/foo/', '', 'baz', '/foo/baz?v1'), + + array('/bar', '/foo', '', '/baz', '/baz?v1'), + array('/bar', '/foo', '', 'baz', '/bar/foo/baz?v1'), + array('/bar', 'foo', '', 'baz', '/bar/foo/baz?v1'), + array('/bar', 'foo/', '', 'baz', '/bar/foo/baz?v1'), + array('/bar', '/foo/', '', 'baz', '/bar/foo/baz?v1'), ); } From 12f1239565f94a4fc9d4593190f7bc59c2dd0743 Mon Sep 17 00:00:00 2001 From: Tyson Andre Date: Sun, 16 Apr 2017 20:24:02 -0700 Subject: [PATCH 48/51] Fix minor phpdoc mismatches with the code(detected by phan) --- .../Component/CssSelector/Parser/Reader.php | 2 +- .../CssSelector/XPath/Extension/NodeExtension.php | 2 +- src/Symfony/Component/ExpressionLanguage/Lexer.php | 8 ++++---- src/Symfony/Component/ExpressionLanguage/Token.php | 2 +- src/Symfony/Component/HttpFoundation/FileBag.php | 2 +- src/Symfony/Component/HttpFoundation/Request.php | 2 +- src/Symfony/Component/HttpKernel/Bundle/Bundle.php | 2 +- .../Component/HttpKernel/Profiler/Profile.php | 5 ++++- .../DateFormatter/DateFormat/FullTransformer.php | 2 +- .../Intl/DateFormatter/IntlDateFormatter.php | 4 ++-- src/Symfony/Component/Intl/Locale/Locale.php | 2 ++ .../Intl/NumberFormatter/NumberFormatter.php | 2 +- .../Component/Serializer/Encoder/XmlEncoder.php | 2 +- src/Symfony/Component/Yaml/Escaper.php | 10 ++++++---- .../Component/Yaml/Exception/ParseException.php | 10 +++++----- src/Symfony/Component/Yaml/Inline.php | 14 +++++++------- 16 files changed, 39 insertions(+), 32 deletions(-) diff --git a/src/Symfony/Component/CssSelector/Parser/Reader.php b/src/Symfony/Component/CssSelector/Parser/Reader.php index ec64c86c8f064..0ba82b4ff63d4 100644 --- a/src/Symfony/Component/CssSelector/Parser/Reader.php +++ b/src/Symfony/Component/CssSelector/Parser/Reader.php @@ -95,7 +95,7 @@ public function getOffset($string) /** * @param string $pattern * - * @return bool + * @return array|false */ public function findPattern($pattern) { diff --git a/src/Symfony/Component/CssSelector/XPath/Extension/NodeExtension.php b/src/Symfony/Component/CssSelector/XPath/Extension/NodeExtension.php index 2c43116fb82fe..c47130aa17c1a 100644 --- a/src/Symfony/Component/CssSelector/XPath/Extension/NodeExtension.php +++ b/src/Symfony/Component/CssSelector/XPath/Extension/NodeExtension.php @@ -70,7 +70,7 @@ public function setFlag($flag, $on) */ public function hasFlag($flag) { - return $this->flags & $flag; + return (bool) ($this->flags & $flag); } /** diff --git a/src/Symfony/Component/ExpressionLanguage/Lexer.php b/src/Symfony/Component/ExpressionLanguage/Lexer.php index 9e746fcbde64d..aeeda8a856c92 100644 --- a/src/Symfony/Component/ExpressionLanguage/Lexer.php +++ b/src/Symfony/Component/ExpressionLanguage/Lexer.php @@ -42,7 +42,7 @@ public function tokenize($expression) continue; } - if (preg_match('/[0-9]+(?:\.[0-9]+)?/A', $expression, $match, null, $cursor)) { + if (preg_match('/[0-9]+(?:\.[0-9]+)?/A', $expression, $match, 0, $cursor)) { // numbers $number = (float) $match[0]; // floats if (preg_match('/^[0-9]+$/', $match[0]) && $number <= PHP_INT_MAX) { @@ -69,11 +69,11 @@ public function tokenize($expression) $tokens[] = new Token(Token::PUNCTUATION_TYPE, $expression[$cursor], $cursor + 1); ++$cursor; - } elseif (preg_match('/"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\'/As', $expression, $match, null, $cursor)) { + } elseif (preg_match('/"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\'/As', $expression, $match, 0, $cursor)) { // strings $tokens[] = new Token(Token::STRING_TYPE, stripcslashes(substr($match[0], 1, -1)), $cursor + 1); $cursor += strlen($match[0]); - } elseif (preg_match('/not in(?=[\s(])|\!\=\=|not(?=[\s(])|and(?=[\s(])|\=\=\=|\>\=|or(?=[\s(])|\<\=|\*\*|\.\.|in(?=[\s(])|&&|\|\||matches|\=\=|\!\=|\*|~|%|\/|\>|\||\!|\^|&|\+|\<|\-/A', $expression, $match, null, $cursor)) { + } elseif (preg_match('/not in(?=[\s(])|\!\=\=|not(?=[\s(])|and(?=[\s(])|\=\=\=|\>\=|or(?=[\s(])|\<\=|\*\*|\.\.|in(?=[\s(])|&&|\|\||matches|\=\=|\!\=|\*|~|%|\/|\>|\||\!|\^|&|\+|\<|\-/A', $expression, $match, 0, $cursor)) { // operators $tokens[] = new Token(Token::OPERATOR_TYPE, $match[0], $cursor + 1); $cursor += strlen($match[0]); @@ -81,7 +81,7 @@ public function tokenize($expression) // punctuation $tokens[] = new Token(Token::PUNCTUATION_TYPE, $expression[$cursor], $cursor + 1); ++$cursor; - } elseif (preg_match('/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/A', $expression, $match, null, $cursor)) { + } elseif (preg_match('/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/A', $expression, $match, 0, $cursor)) { // names $tokens[] = new Token(Token::NAME_TYPE, $match[0], $cursor + 1); $cursor += strlen($match[0]); diff --git a/src/Symfony/Component/ExpressionLanguage/Token.php b/src/Symfony/Component/ExpressionLanguage/Token.php index bb83d50a4d0dc..329273a84be64 100644 --- a/src/Symfony/Component/ExpressionLanguage/Token.php +++ b/src/Symfony/Component/ExpressionLanguage/Token.php @@ -32,7 +32,7 @@ class Token /** * Constructor. * - * @param int $type The type of the token + * @param string $type The type of the token (self::*_TYPE) * @param string $value The token value * @param int $cursor The cursor position in the source */ diff --git a/src/Symfony/Component/HttpFoundation/FileBag.php b/src/Symfony/Component/HttpFoundation/FileBag.php index 197eab42f6c99..e17a9057b7157 100644 --- a/src/Symfony/Component/HttpFoundation/FileBag.php +++ b/src/Symfony/Component/HttpFoundation/FileBag.php @@ -69,7 +69,7 @@ public function add(array $files = array()) * * @param array|UploadedFile $file A (multi-dimensional) array of uploaded file information * - * @return array A (multi-dimensional) array of UploadedFile instances + * @return UploadedFile|UploadedFile[] A (multi-dimensional) array of UploadedFile instances */ protected function convertFileInformation($file) { diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php index f38560473ad0c..0291f9f671aaa 100644 --- a/src/Symfony/Component/HttpFoundation/Request.php +++ b/src/Symfony/Component/HttpFoundation/Request.php @@ -956,7 +956,7 @@ public function getScheme() * If your reverse proxy uses a different header name than "X-Forwarded-Port", * configure it via "setTrustedHeaderName()" with the "client-port" key. * - * @return string + * @return int|string can be a string if fetched from the server bag */ public function getPort() { diff --git a/src/Symfony/Component/HttpKernel/Bundle/Bundle.php b/src/Symfony/Component/HttpKernel/Bundle/Bundle.php index 9c2466d106190..35594e706ca88 100644 --- a/src/Symfony/Component/HttpKernel/Bundle/Bundle.php +++ b/src/Symfony/Component/HttpKernel/Bundle/Bundle.php @@ -127,7 +127,7 @@ public function getPath() /** * Returns the bundle parent name. * - * @return string The Bundle parent name it overrides or null if no parent + * @return string|null The Bundle parent name it overrides or null if no parent */ public function getParent() { diff --git a/src/Symfony/Component/HttpKernel/Profiler/Profile.php b/src/Symfony/Component/HttpKernel/Profiler/Profile.php index d6be0c7db277c..9e0c9fb7dabdd 100644 --- a/src/Symfony/Component/HttpKernel/Profiler/Profile.php +++ b/src/Symfony/Component/HttpKernel/Profiler/Profile.php @@ -156,7 +156,7 @@ public function setUrl($url) /** * Returns the time. * - * @return string The time + * @return int The time */ public function getTime() { @@ -167,6 +167,9 @@ public function getTime() return $this->time; } + /** + * @param int The time + */ public function setTime($time) { $this->time = $time; diff --git a/src/Symfony/Component/Intl/DateFormatter/DateFormat/FullTransformer.php b/src/Symfony/Component/Intl/DateFormatter/DateFormat/FullTransformer.php index 84d5179e576be..958ba95c7cd69 100644 --- a/src/Symfony/Component/Intl/DateFormatter/DateFormat/FullTransformer.php +++ b/src/Symfony/Component/Intl/DateFormatter/DateFormat/FullTransformer.php @@ -133,7 +133,7 @@ public function formatReplace($dateChars, $dateTime) * @param \DateTime $dateTime A configured DateTime object to use to perform the date calculation * @param string $value String to convert to a time value * - * @return int The corresponding Unix timestamp + * @return int|false The corresponding Unix timestamp * * @throws \InvalidArgumentException When the value can not be matched with pattern */ diff --git a/src/Symfony/Component/Intl/DateFormatter/IntlDateFormatter.php b/src/Symfony/Component/Intl/DateFormatter/IntlDateFormatter.php index 3efd5e7bebff3..908afc8acec01 100644 --- a/src/Symfony/Component/Intl/DateFormatter/IntlDateFormatter.php +++ b/src/Symfony/Component/Intl/DateFormatter/IntlDateFormatter.php @@ -348,7 +348,7 @@ public function getPattern() /** * Returns the formatter's time type. * - * @return string The time type used by the formatter + * @return int The time type used by the formatter * * @see http://www.php.net/manual/en/intldateformatter.gettimetype.php */ @@ -433,7 +433,7 @@ public function localtime($value, &$position = 0) * contain -1 otherwise it will contain the position at which parsing * ended. If $parse_pos > strlen($value), the parse fails immediately. * - * @return string Parsed value as a timestamp + * @return int Parsed value as a timestamp * * @see http://www.php.net/manual/en/intldateformatter.parse.php * diff --git a/src/Symfony/Component/Intl/Locale/Locale.php b/src/Symfony/Component/Intl/Locale/Locale.php index cc30c14ffd30d..d4cd37fc696bd 100644 --- a/src/Symfony/Component/Intl/Locale/Locale.php +++ b/src/Symfony/Component/Intl/Locale/Locale.php @@ -315,5 +315,7 @@ public static function setDefault($locale) if ('en' !== $locale) { throw new MethodNotImplementedException(__METHOD__); } + + return true; } } diff --git a/src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php b/src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php index 47e7c60f22c1a..f93147c593ba2 100644 --- a/src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php +++ b/src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php @@ -686,7 +686,7 @@ protected function resetError() * @param float $value The numeric currency value * @param string $currency The 3-letter ISO 4217 currency code indicating the currency to use * - * @return string The rounded numeric currency value + * @return float The rounded numeric currency value * * @see http://en.wikipedia.org/wiki/Swedish_rounding * @see http://www.docjar.com/html/api/com/ibm/icu/util/Currency.java.html#1007 diff --git a/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php b/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php index 2cd5bbd521e0b..e8a24a39d69d0 100644 --- a/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php +++ b/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php @@ -468,7 +468,7 @@ private function appendNode(\DOMNode $parentNode, $data, $nodeName, $key = null) */ private function needsCdataWrapping($val) { - return preg_match('/[<>&]/', $val); + return 0 < preg_match('/[<>&]/', $val); } /** diff --git a/src/Symfony/Component/Yaml/Escaper.php b/src/Symfony/Component/Yaml/Escaper.php index de93d7986e0a5..517a086abdb1d 100644 --- a/src/Symfony/Component/Yaml/Escaper.php +++ b/src/Symfony/Component/Yaml/Escaper.php @@ -31,13 +31,15 @@ class Escaper "\x08", "\x09", "\x0a", "\x0b", "\x0c", "\x0d", "\x0e", "\x0f", "\x10", "\x11", "\x12", "\x13", "\x14", "\x15", "\x16", "\x17", "\x18", "\x19", "\x1a", "\x1b", "\x1c", "\x1d", "\x1e", "\x1f", - "\xc2\x85", "\xc2\xa0", "\xe2\x80\xa8", "\xe2\x80\xa9"); + "\xc2\x85", "\xc2\xa0", "\xe2\x80\xa8", "\xe2\x80\xa9", + ); private static $escaped = array('\\\\', '\\"', '\\\\', '\\"', '\\0', '\\x01', '\\x02', '\\x03', '\\x04', '\\x05', '\\x06', '\\a', '\\b', '\\t', '\\n', '\\v', '\\f', '\\r', '\\x0e', '\\x0f', '\\x10', '\\x11', '\\x12', '\\x13', '\\x14', '\\x15', '\\x16', '\\x17', '\\x18', '\\x19', '\\x1a', '\\e', '\\x1c', '\\x1d', '\\x1e', '\\x1f', - '\\N', '\\_', '\\L', '\\P'); + '\\N', '\\_', '\\L', '\\P', + ); /** * Determines if a PHP value would require double quoting in YAML. @@ -48,7 +50,7 @@ class Escaper */ public static function requiresDoubleQuoting($value) { - return preg_match('/'.self::REGEX_CHARACTER_TO_ESCAPE.'/u', $value); + return 0 < preg_match('/'.self::REGEX_CHARACTER_TO_ESCAPE.'/u', $value); } /** @@ -80,7 +82,7 @@ public static function requiresSingleQuoting($value) // Determines if the PHP value contains any single characters that would // cause it to require single quoting in YAML. - return preg_match('/[ \s \' " \: \{ \} \[ \] , & \* \# \?] | \A[ \- ? | < > = ! % @ ` ]/x', $value); + return 0 < preg_match('/[ \s \' " \: \{ \} \[ \] , & \* \# \?] | \A[ \- ? | < > = ! % @ ` ]/x', $value); } /** diff --git a/src/Symfony/Component/Yaml/Exception/ParseException.php b/src/Symfony/Component/Yaml/Exception/ParseException.php index b74eb9132f513..74548df1f85e1 100644 --- a/src/Symfony/Component/Yaml/Exception/ParseException.php +++ b/src/Symfony/Component/Yaml/Exception/ParseException.php @@ -26,11 +26,11 @@ class ParseException extends RuntimeException /** * Constructor. * - * @param string $message The error message - * @param int $parsedLine The line where the error occurred - * @param int $snippet The snippet of code near the problem - * @param string $parsedFile The file name where the error occurred - * @param \Exception $previous The previous exception + * @param string $message The error message + * @param int $parsedLine The line where the error occurred + * @param string|null $snippet The snippet of code near the problem + * @param string|null $parsedFile The file name where the error occurred + * @param \Exception|null $previous The previous exception */ public function __construct($message, $parsedLine = -1, $snippet = null, $parsedFile = null, \Exception $previous = null) { diff --git a/src/Symfony/Component/Yaml/Inline.php b/src/Symfony/Component/Yaml/Inline.php index 2255379a974c6..06268a2bc6979 100644 --- a/src/Symfony/Component/Yaml/Inline.php +++ b/src/Symfony/Component/Yaml/Inline.php @@ -212,12 +212,12 @@ private static function dumpArray($value, $exceptionOnInvalidType, $objectSuppor /** * Parses a YAML scalar. * - * @param string $scalar - * @param string $delimiters - * @param array $stringDelimiters - * @param int &$i - * @param bool $evaluate - * @param array $references + * @param string $scalar + * @param string[] $delimiters + * @param string[] $stringDelimiters + * @param int &$i + * @param bool $evaluate + * @param array $references * * @return string * @@ -443,7 +443,7 @@ private static function parseMapping($mapping, &$i = 0, $references = array()) * @param string $scalar * @param array $references * - * @return string A YAML string + * @return mixed The evaluated YAML string * * @throws ParseException when object parsing support was disabled and the parser detected a PHP object or when a reference could not be resolved */ From ddc9e78b08bd75e95c1587f2f977c41f9132f911 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 1 May 2017 09:01:06 -0700 Subject: [PATCH 49/51] updated CHANGELOG for 2.7.27 --- CHANGELOG-2.7.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/CHANGELOG-2.7.md b/CHANGELOG-2.7.md index bc4c0fa89d5fc..1d1f0984f1988 100644 --- a/CHANGELOG-2.7.md +++ b/CHANGELOG-2.7.md @@ -7,6 +7,22 @@ in 2.7 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/v2.7.0...v2.7.1 +* 2.7.27 (2017-05-01) + + * bug #22528 [Asset] Starting slash should indicate no basePath wanted (weaverryan) + * bug #22526 [Asset] Preventing the base path or absolute URL from being prefixed incorrectly (weaverryan) + * bug #22435 [Console] Fix dispatching throwables from ConsoleEvents::COMMAND (nicolas-grekas) + * bug #22478 [Serializer] XmlEncoder: fix negative int and large numbers handling (dunglas) + * bug #22424 [Debug] Set exit status to 255 on error (nicolas-grekas) + * bug #22396 Prevent double registrations related to tag priorities (nicolas-grekas) + * bug #22352 [HttpFoundation] Add `use_strict_mode` in validOptions for session (sstok) + * bug #22351 [Yaml] don't keep internal state between parser runs (xabbuh) + * bug #22307 [Debug] Fix php notice (enumag) + * bug #22109 [Validator] check for empty host when calling checkdnsrr() (apetitpa) + * bug #22280 [DI] Fix the xml schema (GuilhemN) + * bug #22255 [Translation] avoid creating cache files for fallback locales. (aitboudad) + * bug #22292 Fixes #22264 - add support for Chrome headless (redthor) + * 2.7.26 (2017-04-04) * bug #22229 [ExpressionLanguage] Provide the expression in syntax errors (k0pernikus, stof) From 44d21493781eeaea9216642e0ce8bb9051351f77 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 1 May 2017 09:01:11 -0700 Subject: [PATCH 50/51] update CONTRIBUTORS for 2.7.27 --- CONTRIBUTORS.md | 51 +++++++++++++++++++++++++++++++------------------ 1 file changed, 32 insertions(+), 19 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 90b929e5efccb..9fe1d4c7e9d50 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -26,9 +26,9 @@ Symfony is the result of the work of many people who made the code better - Grégoire Pineau (lyrixx) - Joseph Bielawski (stloyd) - Karma Dordrak (drak) + - Robin Chalas (chalas_r) - Lukas Kahwe Smith (lsmith) - Martin Hasoň (hason) - - Robin Chalas (chalas_r) - Maxime Steinhausser (ogizanagi) - Jeremy Mikola (jmikola) - Jean-François Simon (jfsimon) @@ -37,10 +37,10 @@ Symfony is the result of the work of many people who made the code better - Eriksen Costa (eriksencosta) - Jules Pietri (heah) - Sarah Khalil (saro0h) + - Roland Franssen (ro0) - Jonathan Wage (jwage) - Guilhem Niot (energetick) - Diego Saint Esteben (dosten) - - Roland Franssen (ro0) - Alexandre Salomé (alexandresalome) - William Durand (couac) - ornicar @@ -73,10 +73,10 @@ Symfony is the result of the work of many people who made the code better - Titouan Galopin (tgalopin) - Douglas Greenshields (shieldo) - Konstantin Myakshin (koc) + - Jáchym Toušek (enumag) - Lee McDermott - Brandon Turner - Luis Cordova (cordoval) - - Jáchym Toušek (enumag) - Graham Campbell (graham) - Daniel Holmes (dholmes) - Toni Uebernickel (havvg) @@ -84,12 +84,12 @@ Symfony is the result of the work of many people who made the code better - Jordan Alliot (jalliot) - Jérémy DERUSSÉ (jderusse) - John Wards (johnwards) + - Dariusz Ruminski - Fran Moreno (franmomu) - Antoine Hérault (herzult) + - Jérôme Tamarelle (gromnan) - Paráda József (paradajozsef) - - Dariusz Ruminski - Arnaud Le Blanc (arnaud-lb) - - Jérôme Tamarelle (gromnan) - Maxime STEINHAUSSER - Michal Piotrowski (eventhorizon) - Tim Nagel (merk) @@ -120,6 +120,7 @@ Symfony is the result of the work of many people who made the code better - Théo FIDRY (theofidry) - Robert Schönthal (digitalkaoz) - Florian Lonqueu-Brochard (florianlb) + - Sebastiaan Stok (sstok) - Stefano Sala (stefano.sala) - Yonel Ceruto González (yonelceruto) - Evgeniy (ewgraf) @@ -128,7 +129,6 @@ Symfony is the result of the work of many people who made the code better - Sebastian Hörl (blogsh) - Daniel Gomes (danielcsgomes) - Hidenori Goto (hidenorigoto) - - Sebastiaan Stok (sstok) - Guilherme Blanco (guilhermeblanco) - Pablo Godel (pgodel) - Jérémie Augustin (jaugustin) @@ -146,6 +146,7 @@ Symfony is the result of the work of many people who made the code better - Vincent AUBERT (vincent) - Rouven Weßling (realityking) - Teoh Han Hui (teohhanhui) + - Jérôme Vasseur (jvasseur) - Clemens Tolboom - Helmer Aaviksoo - Grégoire Paris (greg0ire) @@ -178,8 +179,11 @@ Symfony is the result of the work of many people who made the code better - Daniel Espendiller - sun (sun) - Larry Garfield (crell) + - Julien Falque (julienfalque) - Martin Schuhfuß (usefulthink) + - apetitpa - Matthieu Bontemps (mbontemps) + - apetitpa - Pierre Minnieur (pminnieur) - fivestar - Dominique Bongiraud @@ -201,7 +205,6 @@ Symfony is the result of the work of many people who made the code better - SpacePossum - Eugene Wissner - Julien Brochet (mewt) - - Julien Falque (julienfalque) - Tristan Darricau (nicofuma) - Sergey Linnik (linniksa) - Michaël Perrin (michael.perrin) @@ -220,7 +223,6 @@ Symfony is the result of the work of many people who made the code better - Elnur Abdurrakhimov (elnur) - Manuel Reinhard (sprain) - Danny Berger (dpb587) - - Jérôme Vasseur - Ruben Gonzalez (rubenrua) - Adam Prager (padam87) - Roman Marintšenko (inori) @@ -230,6 +232,7 @@ Symfony is the result of the work of many people who made the code better - Arjen Brouwer (arjenjb) - Katsuhiro OGAWA - Patrick McDougle (patrick-mcdougle) + - Dany Maillard (maidmaid) - Alif Rachmawadi - Kristen Gilden (kgilden) - Pierre-Yves LEBECQ (pylebecq) @@ -267,7 +270,9 @@ Symfony is the result of the work of many people who made the code better - Michael Holm (hollo) - Marc Weistroff (futurecat) - Christian Schmidt + - Marek Štípek (maryo) - Hidde Wieringa (hiddewie) + - Jordan Samouh (jordansamouh) - Chris Smith (cs278) - Florian Klein (docteurklein) - Oleg Voronkovich @@ -281,6 +286,7 @@ Symfony is the result of the work of many people who made the code better - Andrey Esaulov (andremaha) - Grégoire Passault (gregwar) - Ismael Ambrosi (iambrosi) + - gadelat (gadelat) - Baptiste Lafontaine - Aurelijus Valeiša (aurelijus) - Victor Bocharsky (bocharsky_bw) @@ -324,7 +330,8 @@ Symfony is the result of the work of many people who made the code better - Yaroslav Kiliba - Terje Bråten - Robbert Klarenbeek (robbertkl) - - Marek Štípek (maryo) + - Thomas Calvet (fancyweb) + - Niels Keurentjes (curry684) - Alessandro Chitolina - JhonnyL - hossein zolfi (ocean) @@ -342,14 +349,15 @@ Symfony is the result of the work of many people who made the code better - Vyacheslav Salakhutdinov (megazoll) - Jerzy Zawadzki (jzawadzki) - Hassan Amouhzi - - gadelat (gadelat) - Tamas Szijarto - Pavel Volokitin (pvolok) - François Pluchino (francoispluchino) + - Arthur de Moulins (4rthem) - Nicolas Dewez (nicolas_dewez) - Endre Fejes - Tobias Naumann (tna) - Daniel Beyer + - Nikolay Labinskiy (e-moe) - Shein Alexey - Romain Gautier (mykiwi) - Joe Lencioni @@ -399,10 +407,10 @@ Symfony is the result of the work of many people who made the code better - Andreas Braun - Chris Sedlmayr (catchamonkey) - Seb Koelen - - Dany Maillard (maidmaid) - Christoph Mewes (xrstf) - Vitaliy Tverdokhlib (vitaliytv) - Ariel Ferrandini (aferrandini) + - Samuel ROZE (sroze) - Dirk Pahl (dirkaholic) - cedric lombardot (cedriclombardot) - Jonas Flodén (flojon) @@ -416,7 +424,6 @@ Symfony is the result of the work of many people who made the code better - Gintautas Miselis - Rob Bast - David Badura (davidbadura) - - Jordan Samouh (jordansamouh) - Zander Baldwin - Adam Harvey - Alex Bakhturin @@ -425,7 +432,6 @@ Symfony is the result of the work of many people who made the code better - Fabrice Bernhard (fabriceb) - Jérôme Macias (jeromemacias) - Andrey Astakhov (aast) - - Thomas Calvet - Fabian Lange (codingfabian) - Frank Neff (fneff) - Roman Lapin (memphys) @@ -461,13 +467,12 @@ Symfony is the result of the work of many people who made the code better - Jakub Škvára (jskvara) - Andrew Udvare (audvare) - alexpods - - Nikolay Labinskiy (e-moe) - Arjen van der Meijden - Michele Locati - Dariusz Ruminski + - Alex Rock Ancelet (pierstoval) - Erik Trapman (eriktrapman) - De Cock Xavier (xdecock) - - Arthur de Moulins (4rthem) - Almog Baku (almogbaku) - Scott Arciszewski - Norbert Orzechowicz (norzechowicz) @@ -581,7 +586,6 @@ Symfony is the result of the work of many people who made the code better - Ulumuddin Yunus (joenoez) - Luc Vieillescazes (iamluc) - Johann Saunier (prophet777) - - Samuel ROZE (sroze) - Michael Devery (mickadoo) - Antoine Corcy - Artur Eshenbrener @@ -695,6 +699,7 @@ Symfony is the result of the work of many people who made the code better - Pierre Vanliefland (pvanliefland) - Sofiane HADDAG (sofhad) - frost-nzcr4 + - Sanpi - Abhoryo - Fabian Vogler (fabian) - Korvin Szanto @@ -751,6 +756,7 @@ Symfony is the result of the work of many people who made the code better - Martijn Evers - Jacques Moati - Balazs Csaba (balazscsaba2006) + - Douglas Reith (douglas_reith) - Harry Walter (haswalt) - Johnson Page (jwpage) - Michael Roterman (wtfzdotnet) @@ -764,7 +770,6 @@ Symfony is the result of the work of many people who made the code better - Gábor Tóth - Daniel Cestari - David Lima - - Jérôme Vasseur - Brunet Laurent (lbrunet) - Mikhail Yurasov (mym) - LOUARDI Abdeltif (ouardisoft) @@ -819,6 +824,7 @@ Symfony is the result of the work of many people who made the code better - Danilo Silva - Zachary Tong (polyfractal) - Hryhorii Hrebiniuk + - Thomas Perez (scullwm) - Dennis Fridrich (dfridrich) - hamza - dantleech @@ -933,6 +939,7 @@ Symfony is the result of the work of many people who made the code better - Klaus Purer - Gilles Doge (gido) - abulford + - Philipp Kretzschmar - antograssiot - Brooks Boyd - Roger Webb @@ -1039,6 +1046,7 @@ Symfony is the result of the work of many people who made the code better - Kim Laï Trinh - Jason Desrosiers - m.chwedziak + - insekticid - Philip Frank - Lance McNearney - Giorgio Premi @@ -1061,6 +1069,7 @@ Symfony is the result of the work of many people who made the code better - Tadcka - Beth Binkovitz - Gonzalo Míguez + - Pierre Rineau - Romain Geissler - Adrien Moiruad - Tomaz Ahlin @@ -1084,6 +1093,7 @@ Symfony is the result of the work of many people who made the code better - Martin Eckhardt - Pieter Jordaan - Damien Tournoud + - Craig Duncan (duncan3dc) - Jon Gotlin (jongotlin) - Michael Dowling (mtdowling) - Karlos Presumido (oneko) @@ -1184,12 +1194,12 @@ Symfony is the result of the work of many people who made the code better - Michal Gebauer - Gleb Sidora - David Stone - - Niels Keurentjes (curry684) - Jovan Perovic (jperovic) - Pablo Maria Martelletti (pmartelletti) - Yassine Guedidi (yguedidi) - Waqas Ahmed - Luis Muñoz + - Matthew Donadio - Andreas - Thomas Chmielowiec - Andrey Ryaguzov @@ -1246,7 +1256,6 @@ Symfony is the result of the work of many people who made the code better - Jordi Llonch (jordillonch) - Cédric Dugat (ph3nol) - Philip Dahlstrøm (phidah) - - Alex Rock Ancelet (pierstoval) - Milos Colakovic (project2481) - Rénald Casagraude (rcasagraude) - Robin Duval (robin-duval) @@ -1389,6 +1398,7 @@ Symfony is the result of the work of many people who made the code better - Joeri Verdeyen (jverdeyen) - Kevin Herrera (kherge) - Luis Ramón López López (lrlopez) + - Bart Reunes (metalarend) - Muriel (metalmumu) - Michael Pohlers (mick_the_big) - mlpo (mlpo) @@ -1530,6 +1540,7 @@ Symfony is the result of the work of many people who made the code better - Oncle Tom - Christian Stocker - Dawid Nowak + - Lesnykh Ilia - Karolis Daužickas - Sergio Santoro - tirnanog06 @@ -1594,6 +1605,7 @@ Symfony is the result of the work of many people who made the code better - Florent Viel (luxifer) - Matthieu Moquet (mattketmo) - Moritz Borgmann (mborgmann) + - Michal Čihař (mcihar) - Matt Drollette (mdrollette) - Adam Monsen (meonkeys) - Ala Eddine Khefifi (nayzo) @@ -1646,6 +1658,7 @@ Symfony is the result of the work of many people who made the code better - smokeybear87 - Gustavo Adrian - Kevin Weber + - Ben Scott - Dionysis Arvanitis - Sergey Fedotov - Michael From 161bed58beb3b598a55216c74a23bfd4450b2750 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 1 May 2017 09:01:24 -0700 Subject: [PATCH 51/51] updated VERSION for 2.7.27 --- src/Symfony/Component/HttpKernel/Kernel.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 0d37a6d05e409..35f7dcccaaec6 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -58,12 +58,12 @@ abstract class Kernel implements KernelInterface, TerminableInterface protected $startTime; protected $loadClassCache; - const VERSION = '2.7.27-DEV'; + const VERSION = '2.7.27'; const VERSION_ID = 20727; const MAJOR_VERSION = 2; const MINOR_VERSION = 7; const RELEASE_VERSION = 27; - const EXTRA_VERSION = 'DEV'; + const EXTRA_VERSION = ''; const END_OF_MAINTENANCE = '05/2018'; const END_OF_LIFE = '05/2019';