Skip to content

Commit 7fc3046

Browse files
Merge branch '2.7' into 2.8
* 2.7: [Form] fix Catchable Fatal Error if choices is not an array [Process] Fix a transient test [Process] Fix potential race condition leading to transient tests [Routing] removed unused variable in PhpMatcherDumperTest class. [travis] use github token to fetch deps from ZIP files [DependencyInjection] fixes typo in triggered deprecation notice. [Form] improve deprecation messages for the "empty_value" and "choice_list" options in the ChoiceType class. Conflicts: src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php
2 parents ddc508b + 2c2daf1 commit 7fc3046

File tree

10 files changed

+46
-25
lines changed

10 files changed

+46
-25
lines changed

.composer-auth.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"github-oauth": {
3+
"github.com": "PLEASE DO NOT USE THIS TOKEN IN YOUR OWN PROJECTS/FORKS",
4+
"github.com": "This token is reserved for testing the symfony/symfony repository",
5+
"github.com": "52270bad1071a099c8d24629f2db2b7f07db960d"
6+
}
7+
}

.travis.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ before_install:
4343
- if [[ $TRAVIS_PHP_VERSION = 5.* && ! $deps ]]; then (cd src/Symfony/Component/Debug/Resources/ext && phpize && ./configure && make && echo extension = $(pwd)/modules/symfony_debug.so >> $INI_FILE); fi;
4444
- if [[ $TRAVIS_PHP_VERSION != hhvm ]]; then echo extension = ldap.so >> $INI_FILE; fi;
4545
- if [[ $TRAVIS_PHP_VERSION != hhvm ]]; then phpenv config-rm xdebug.ini; fi;
46+
- if [[ $TRAVIS_REPO_SLUG = symfony/symfony ]]; then cp .composer-auth.json ~/.composer/auth.json; fi;
4647
- if [[ $deps != skip ]]; then composer self-update; fi;
4748
- if [[ $deps != skip ]]; then ./phpunit install; fi;
4849
- export PHPUNIT=$(readlink -f ./phpunit)
@@ -54,13 +55,13 @@ install:
5455
- if [[ $deps = high && $TRAVIS_BRANCH = master ]]; then git fetch origin $SYMFONY_VERSION; git checkout -m FETCH_HEAD; fi;
5556
- 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;
5657
- export COMPOSER_ROOT_VERSION=$SYMFONY_VERSION.x-dev;
57-
- if [[ ! $deps ]]; then composer --prefer-source install; else export SYMFONY_DEPRECATIONS_HELPER=weak; fi;
58+
- if [[ ! $deps ]]; then composer update --prefer-dist; else export SYMFONY_DEPRECATIONS_HELPER=weak; fi;
5859
- if [[ $TRAVIS_PHP_VERSION != hhvm ]]; then php -i; else hhvm --php -r 'print_r($_SERVER);print_r(ini_get_all());'; fi;
5960

6061
script:
6162
- if [[ ! $deps ]]; then echo "$COMPONENTS" | parallel --gnu '$PHPUNIT --exclude-group tty,benchmark,intl-data {}'; fi;
6263
- if [[ ! $deps ]]; then echo -e "\\nRunning tests requiring tty"; $PHPUNIT --group tty; fi;
6364
- if [[ ! $deps && $TRAVIS_PHP_VERSION = ${MIN_PHP%.*} ]]; then echo -e "1\\n0" | parallel --gnu --timeout 60 'echo -e "\\nPHP --enable-sigchild enhanced={}" && ENHANCE_SIGCHLD={} php-$MIN_PHP/sapi/cli/php .phpunit/phpunit-4.8/phpunit --colors=always src/Symfony/Component/Process/'; fi;
64-
- if [[ $deps = high ]]; then echo "$COMPONENTS" | parallel --gnu -j10% 'cd {}; composer --prefer-source update; $PHPUNIT --exclude-group tty,benchmark,intl-data'$LEGACY; fi;
65-
- if [[ $deps = low ]]; then echo "$COMPONENTS" | parallel --gnu -j10% 'cd {}; composer --prefer-source --prefer-lowest --prefer-stable update; $PHPUNIT --exclude-group tty,benchmark,intl-data'; fi;
65+
- if [[ $deps = high ]]; then echo "$COMPONENTS" | parallel --gnu -j10% 'cd {}; composer update --prefer-dist; $PHPUNIT --exclude-group tty,benchmark,intl-data'$LEGACY; fi;
66+
- if [[ $deps = low ]]; then echo "$COMPONENTS" | parallel --gnu -j10% 'cd {}; composer update --prefer-dist --prefer-lowest --prefer-stable; $PHPUNIT --exclude-group tty,benchmark,intl-data'; fi;
6667
- if [[ $deps = skip ]]; then echo This matrix line is skipped for pull requests.; fi;

appveyor.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,11 @@ install:
5050
- appveyor DownloadFile https://getcomposer.org/composer.phar
5151
- copy /Y php.ini-max php.ini
5252
- cd c:\projects\symfony
53+
- mkdir %APPDATA%\Composer
54+
- IF %APPVEYOR_REPO_NAME%==symfony/symfony copy /Y .composer-auth.json %APPDATA%\Composer\auth.json
5355
- php phpunit install
5456
- IF %APPVEYOR_REPO_BRANCH%==master (SET COMPOSER_ROOT_VERSION=dev-master) ELSE (SET COMPOSER_ROOT_VERSION=%APPVEYOR_REPO_BRANCH%.x-dev)
55-
- composer update --prefer-source --no-progress --ansi
57+
- composer update --prefer-dist --no-progress --ansi
5658

5759
test_script:
5860
- cd c:\projects\symfony

phpunit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ if (!file_exists("$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit") || md5_file(__
5353
chdir("phpunit-$PHPUNIT_VERSION");
5454
passthru("$COMPOSER remove --no-update symfony/yaml");
5555
passthru("$COMPOSER require --dev --no-update symfony/phpunit-bridge \">=2.8@dev\"");
56-
passthru("$COMPOSER install --prefer-source --no-progress --ansi");
56+
passthru("$COMPOSER install --prefer-dist --no-progress --ansi");
5757
file_put_contents('phpunit', <<<EOPHP
5858
<?php
5959

src/Symfony/Component/DependencyInjection/SimpleXMLElement.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
namespace Symfony\Component\DependencyInjection;
1313

14-
@trigger_error('The '.__NAMESPACE__.'\SimpleXMLElement method is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
14+
@trigger_error('The '.__NAMESPACE__.'\SimpleXMLElement class is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
1515

1616
use Symfony\Component\Config\Util\XmlUtils;
1717
use Symfony\Component\ExpressionLanguage\Expression;

src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -294,9 +294,10 @@ public function configureOptions(OptionsResolver $resolver)
294294
return;
295295
};
296296

297-
$choiceListNormalizer = function (Options $options, $choiceList) use ($choiceListFactory) {
297+
$that = $this;
298+
$choiceListNormalizer = function (Options $options, $choiceList) use ($choiceListFactory, $that) {
298299
if ($choiceList) {
299-
@trigger_error('The "choice_list" option is deprecated since version 2.7 and will be removed in 3.0. Use "choice_loader" instead.', E_USER_DEPRECATED);
300+
@trigger_error(sprintf('The "choice_list" option of the "%s" form type (%s) is deprecated since version 2.7 and will be removed in 3.0. Use "choice_loader" instead.', $that->getName(), __CLASS__), E_USER_DEPRECATED);
300301

301302
if ($choiceList instanceof LegacyChoiceListInterface) {
302303
return new LegacyChoiceListAdapter($choiceList);
@@ -323,17 +324,17 @@ public function configureOptions(OptionsResolver $resolver)
323324
return $choiceListFactory->createListFromChoices($choices, $options['choice_value']);
324325
};
325326

326-
$choicesAsValuesNormalizer = function (Options $options, $choicesAsValues) {
327+
$choicesAsValuesNormalizer = function (Options $options, $choicesAsValues) use ($that) {
327328
if (true !== $choicesAsValues) {
328-
@trigger_error('The value "false" for the "choices_as_values" option is deprecated since version 2.8 and will not be supported anymore in 3.0. Set this option to "true" and flip the contents of the "choices" option instead.', E_USER_DEPRECATED);
329+
@trigger_error(sprintf('The value "false" for the "choices_as_values" option of the "%s" form type (%s) is deprecated since version 2.8 and will not be supported anymore in 3.0. Set this option to "true" and flip the contents of the "choices" option instead.', $that->getName(), __CLASS__), E_USER_DEPRECATED);
329330
}
330331

331332
return $choicesAsValues;
332333
};
333334

334-
$placeholderNormalizer = function (Options $options, $placeholder) {
335+
$placeholderNormalizer = function (Options $options, $placeholder) use ($that) {
335336
if (!is_object($options['empty_value']) || !$options['empty_value'] instanceof \Exception) {
336-
@trigger_error('The form option "empty_value" is deprecated since version 2.6 and will be removed in 3.0. Use "placeholder" instead.', E_USER_DEPRECATED);
337+
@trigger_error(sprintf('The form option "empty_value" of the "%s" form type (%s) is deprecated since version 2.6 and will be removed in 3.0. Use "placeholder" instead.', $that->getName(), __CLASS__), E_USER_DEPRECATED);
337338

338339
$placeholder = $options['empty_value'];
339340
}
@@ -522,10 +523,10 @@ private function createChoiceListView(ChoiceListInterface $choiceList, array $op
522523
* are lost. Store them in a utility array that is used from the
523524
* "choice_label" closure by default.
524525
*
525-
* @param array|\Traversable $choices The choice labels indexed by choices.
526-
* @param object $choiceLabels The object that receives the choice labels
527-
* indexed by generated keys.
528-
* @param int $nextKey The next generated key.
526+
* @param array|\Traversable $choices The choice labels indexed by choices.
527+
* @param object $choiceLabels The object that receives the choice labels
528+
* indexed by generated keys.
529+
* @param int $nextKey The next generated key.
529530
*
530531
* @return array The choices in a normalized array with labels replaced by generated keys.
531532
*

src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,21 @@ public function testSubmitSingleNonExpandedObjectChoices()
499499
$this->assertTrue($form->isSynchronized());
500500
}
501501

502+
/**
503+
* @group legacy
504+
*/
505+
public function testLegacyNullChoices()
506+
{
507+
$form = $this->factory->create('choice', null, array(
508+
'multiple' => false,
509+
'expanded' => false,
510+
'choices' => null,
511+
));
512+
$this->assertNull($form->getConfig()->getOption('choices'));
513+
$this->assertFalse($form->getConfig()->getOption('multiple'));
514+
$this->assertFalse($form->getConfig()->getOption('expanded'));
515+
}
516+
502517
/**
503518
* @group legacy
504519
*/

src/Symfony/Component/Process/Process.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,13 +1339,10 @@ private function readPipes($blocking, $close)
13391339

13401340
$callback = $this->callback;
13411341
foreach ($result as $type => $data) {
1342-
if (3 === $type) {
1343-
$this->fallbackStatus['running'] = false;
1344-
if (!isset($this->fallbackStatus['signaled'])) {
1345-
$this->fallbackStatus['exitcode'] = (int) $data;
1346-
}
1347-
} else {
1342+
if (3 !== $type) {
13481343
$callback($type === self::STDOUT ? self::OUT : self::ERR, $data);
1344+
} elseif (!isset($this->fallbackStatus['signaled'])) {
1345+
$this->fallbackStatus['exitcode'] = (int) $data;
13491346
}
13501347
}
13511348
}

src/Symfony/Component/Process/Tests/ProcessTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ public function testSetStreamAsInput($code, $size)
193193
fwrite($stream, $expected);
194194
rewind($stream);
195195

196-
$p = $this->getProcess(sprintf('%s -r %s', self::$phpBin, escapeshellarg($code)), null, null, null, 5);
196+
$p = $this->getProcess(sprintf('%s -r %s', self::$phpBin, escapeshellarg($code)));
197197
$p->setInput($stream);
198198
$p->run();
199199

src/Symfony/Component/Routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,6 @@ public function getRouteCollections()
186186
$route1 = new Route('/route1', array(), array(), array(), 'a.example.com');
187187
$collection1->add('route1', $route1);
188188

189-
$collection2 = new RouteCollection();
190-
191189
$route2 = new Route('/c2/route2', array(), array(), array(), 'a.example.com');
192190
$collection1->add('route2', $route2);
193191

0 commit comments

Comments
 (0)