E576 Merge branch '3.2' into 3.3 · symfony/symfony@bb84872 · GitHub
[go: up one dir, main page]

Skip to content

Commit bb84872

Browse files
Merge branch '3.2' into 3.3
* 3.2: typo [Console] Fix tests [Console] Fixed different behaviour of key and value user inputs in multiple choice question [Cache] Dont use pipelining with RedisCluster [Yaml] fix colon without space deprecation [Intl] Fix intl tests for PHP < 5.5.10
2 parents df7fe48 + 029f89a commit bb84872

File tree

7 files changed

+54
-7
lines changed
  • Yaml
  • 7 files changed

    +54
    -7
    lines changed

    src/Symfony/Component/Cache/Traits/RedisTrait.php

    Lines changed: 8 additions & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -303,6 +303,14 @@ private function pipeline(\Closure $generator)
    303303
    foreach ($results as $k => list($h, $c)) {
    304304
    $results[$k] = $connections[$h][$c];
    305305
    }
    306+
    } elseif ($this->redis instanceof \RedisCluster) {
    307+
    // phpredis doesn't support pipelining with RedisCluster
    308+
    // see https://github.com/phpredis/phpredis/blob/develop/cluster.markdown#pipelining
    309+
    $results = array();
    310+
    foreach ($generator() as $command => $args) {
    311+
    $results[] = call_user_func_array(array($this->redis, $command), $args);
    312+
    $ids[] = $args[0];
    313+
    }
    306314
    } else {
    307315
    $this->redis->multi(\Redis::PIPELINE);
    308316
    foreach ($generator() as $command => $args) {

    src/Symfony/Component/Console/Question/ChoiceQuestion.php

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -137,7 +137,7 @@ private function getDefaultValidator()
    137137

    138138
    if ($multiselect) {
    139139
    // Check for a separated comma values
    140-
    if (!preg_match('/^[a-zA-Z0-9_-]+(?:,[a-zA-Z0-9_-]+)*$/', $selectedChoices, $matches)) {
    140+
    if (!preg_match('/^[^,]+(?:,[^,]+)*$/', $selectedChoices, $matches)) {
    141141
    throw new InvalidArgumentException(sprintf($errorMessage, $selected));
    142142
    }
    143143
    $selectedChoices = explode(',', $selectedChoices);

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

    Lines changed: 31 additions & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -267,6 +267,37 @@ public function simpleAnswerProvider()
    267267
    );
    268268
    }
    269269

    270+
    /**
    271+
    * @dataProvider specialCharacterInMultipleChoice
    272+
    */
    273+
    public function testSpecialCharacterChoiceFromMultipleChoiceList($providedAnswer, $expectedValue)
    274+
    {
    275+
    $possibleChoices = array(
    276+
    '.',
    277+
    'src',
    278+
    );
    279+
    280+
    $dialog = new QuestionHelper();
    281+
    $inputStream = $this->getInputStream($providedAnswer."\n");
    282+
    $helperSet = new HelperSet(array(new FormatterHelper()));
    283+
    $dialog->setHelperSet($helperSet);
    284+
    285+
    $question = new ChoiceQuestion('Please select the directory', $possibleChoices);
    286+
    $question->setMaxAttempts(1);
    287+
    $question->setMultiselect(true);
    288+
    $answer = $dialog->ask($this->createStreamableInputInterfaceMock($inputStream), $this->createOutputInterface(), $question);
    289+
    290+
    $this->assertSame($expectedValue, $answer);
    291+
    }
    292+
    293+
    public function specialCharacterInMultipleChoice()
    294+
    {
    295+
    return array(
    296+
    array('.', array('.')),
    297+
    array('., src', array('.', 'src')),
    298+
    );
    299+
    }
    300+
    270301
    /**
    271302
    * @dataProvider mixedKeysChoiceListAnswerProvider
    272303
    */

    src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php

    Lines changed: 4 additions & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -318,7 +318,7 @@ public function formatWithTimezoneProvider()
    318318

    319319
    /**
    320320
    * @dataProvider formatTimezoneProvider
    321-
    * @requires PHP 5.5
    321+
    * @requires PHP 5.5.10
    322322
    */
    323323
    public function testFormatTimezone($pattern, $timezone, $expected)
    324324
    {
    @@ -423,6 +423,9 @@ public function testFormatWithConstructorTimezone()
    423423
    );
    424424
    }
    425425

    426+
    /**
    427+
    * @requires PHP 5.5.10
    428+
    */
    426429
    public function testFormatWithDateTimeZoneGmt()
    427430
    {
    428431
    $formatter = $this->getDateFormatter('en', IntlDateFormatter::MEDIUM, IntlDateFormatter::SHORT, new \DateTimeZone('GMT'), IntlDateFormatter::GREGORIAN, 'zzz');

    src/Symfony/Component/Yaml/CHANGELOG.md

    Lines changed: 2 additions & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -53,8 +53,8 @@ CHANGELOG
    5353
    -----
    5454

    5555
    * Mappings with a colon (`:`) that is not followed by a whitespace are deprecated
    56-
    and will lead to a `ParseException` in Symfony 4.0 (e.g. `foo:bar` must be
    57-
    `foo: bar`).
    56+
    when the mapping key is not quoted and will lead to a `ParseException` in
    57+
    Symfony 4.0 (e.g. `foo:bar` must be `foo: bar`).
    5858

    5959
    * Added support for parsing PHP constants:
    6060

    src/Symfony/Component/Yaml/Inline.php

    Lines changed: 3 additions & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -479,6 +479,7 @@ private static function parseMapping($mapping, $flags, &$i = 0, $references = ar
    479479
    }
    480480

    481481
    // key
    482+
    $isKeyQuoted = in_array($mapping[$i], array('"', "'"), true);
    482483
    $key = self::parseScalar($mapping, $flags, array(':', ' '), $i, false, array(), true);
    483484

    484485
    if (':' !== $key && false === $i = strpos($mapping, ':', $i)) {
    @@ -497,8 +498,8 @@ private static function parseMapping($mapping, $flags, &$i = 0, $references = ar
    497498
    }
    498499
    }
    499500

    500-
    if (':' !== $key && (!isset($mapping[$i + 1]) || !in_array($mapping[$i + 1], array(' ', ',', '[', ']', '{', '}'), true))) {
    501-
    @trigger_error('Using a colon that is not followed by an indication character (i.e. " ", ",", "[", "]", "{", "}" is deprecated since version 3.2 and will throw a ParseException in 4.0.', E_USER_DEPRECATED);
    501+
    if (':' !== $key && !$isKeyQuoted && (!isset($mapping[$i + 1]) || !in_array($mapping[$i + 1], array(' ', ',', '[', ']', '{', '}'), true))) {
    502+
    @trigger_error('Using a colon after an unquoted mapping key that is not followed by an indication character (i.e. " ", ",", "[", "]", "{", "}") is deprecated since version 3.2 and will throw a ParseException in 4.0.', E_USER_DEPRECATED);
    502503
    }
    503504

    504505
    while ($i < $len) {

    src/Symfony/Component/Yaml/Tests/InlineTest.php

    Lines changed: 5 additions & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -168,7 +168,7 @@ public function testParseInvalidMappingKeyShouldThrowException()
    168168

    169169
    /**
    170170
    * @group legacy
    171-
    * @expectedDeprecation Using a colon that is not followed by an indication character (i.e. " ", ",", "[", "]", "{", "}" is deprecated since version 3.2 and will throw a ParseException in 4.0.
    171+
    * @expectedDeprecation Using a colon after an unquoted mapping key that is not followed by an indication character (i.e. " ", ",", "[", "]", "{", "}") is deprecated since version 3.2 and will throw a ParseException in 4.0.
    172172
    * throws \Symfony\Component\Yaml\Exception\ParseException in 4.0
    173173
    */
    174174
    public function testParseMappingKeyWithColonNotFollowedBySpace()
    @@ -391,6 +391,8 @@ public function getTestsForParse()
    391391
    array('{\'foo\': \'bar\', "bar": \'foo: bar\'}', array('foo' => 'bar', 'bar' => 'foo: bar')),
    392392
    array('{\'foo\'\'\': \'bar\', "bar\"": \'foo: bar\'}', array('foo\'' => 'bar', 'bar"' => 'foo: bar')),
    393393
    array('{\'foo: \': \'bar\', "bar: ": \'foo: bar\'}', array('foo: ' => 'bar', 'bar: ' => 'foo: bar')),
    394+
    array('{"foo:bar": "baz"}', array('foo:bar' => 'baz')),
    395+
    array('{"foo":"bar"}', array('foo' => 'bar')),
    394396

    395397
    // nested sequences and mappings
    396398
    array('[foo, [bar, foo]]', array('foo', array('bar', 'foo'))),
    @@ -460,6 +462,8 @@ public function getTestsForParseWithMapObjects()
    460462
    array('{\'foo\': \'bar\', "bar": \'foo: bar\'}', (object) array('foo' => 'bar', 'bar' => 'foo: bar')),
    461463
    array('{\'foo\'\'\': \'bar\', "bar\"": \'foo: bar\'}', (object) array('foo\'' => 'bar', 'bar"' => 'foo: bar')),
    462464
    array('{\'foo: \': \'bar\', "bar: ": \'foo: bar\'}', (object) array('foo: ' => 'bar', 'bar: ' => 'foo: bar')),
    465+
    array('{"foo:bar": "baz"}', (object) array('foo:bar' => 'baz')),
    466+
    array('{"foo":"bar"}', (object) array('foo' => 'bar')),
    463467

    464468
    // nested sequences and mappings
    465469
    array('[foo, [bar, foo]]', array('foo', array('bar', 'foo'))),

    0 commit comments

    Comments
     (0)
    0