Skip to content

Commit 6cc5756

Browse files
Merge branch '2.7' into 2.8
* 2.7: prefer phpunit 5.x on hhvm [FrameworkBundle][HttpKernel] the finder is required to discover bundle commands [travis] Auto-conf deps=high matrix line Fix the logout path when not using the router Fix the logout path when not using the router [Form] cast IDs to match deprecated behaviour of EntityChoiceList [HttpFoundation] Added the ability of mapping stream wrapper protocols when using X-Sendfile [HttpFoundation] Add a test case for using BinaryFileResponse with stream wrappers Conflicts: .travis.yml src/Symfony/Bundle/FrameworkBundle/composer.json
2 parents da767b8 + 85814de commit 6cc5756

File tree

11 files changed

+259
-51
lines changed

11 files changed

+259
-51
lines changed

.travis.yml

Lines changed: 38 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@ addons:
77
- parallel
88
- language-pack-fr-base
99

10-
cache:
11-
directories:
12-
- .phpunit
13-
- php-5.3.9
10+
env:
11+
global:
12+
- MIN_PHP=5.3.9
1413

1514
matrix:
1615
include:
@@ -20,46 +19,48 @@ matrix:
2019
- php: 5.5
2120
- php: 5.6
2221
env: deps=high
23-
- php: 7
22+
- php: 7.0
2423
env: deps=low
2524
fast_finish: true
2625

27-
services: mongodb
26+
cache:
27+
directories:
28+
- .phpunit
29+
- php-$MIN_PHP
2830

29-
env:
30-
global:
31-
- deps=no
32-
- SYMFONY_DEPRECATIONS_HELPER=weak
31+
services: mongodb
3332

3433
before_install:
35-
- if [[ "$deps" = "no" ]] && [[ "$TRAVIS_PHP_VERSION" =~ 5.[45] ]] && [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then export deps=skip; fi;
36-
- if [[ $deps = no && $TRAVIS_PHP_VERSION = 5.3 && ! -d php-5.3.9/sapi ]]; then wget http://museum.php.net/php5/php-5.3.9.tar.bz2; tar -xjf php-5.3.9.tar.bz2; (cd php-5.3.9; ./configure --enable-sigchild --enable-pcntl; make -j2); fi;
37-
- if [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then INI_FILE=~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini; else INI_FILE=/etc/hhvm/php.ini; fi;
38-
- echo "memory_limit = -1" >> $INI_FILE
39-
- echo "session.gc_probability = 0" >> $INI_FILE
40-
- if [ "$deps" != "skip" ]; then composer self-update; fi;
41-
- if [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then phpenv config-rm xdebug.ini; fi;
42-
- if [[ "$TRAVIS_PHP_VERSION" = 5.* ]]; then echo "extension = mongo.so" >> $INI_FILE; fi;
43-
- if [[ "$TRAVIS_PHP_VERSION" = 5.* ]]; then echo "extension = memcache.so" >> $INI_FILE; fi;
44-
- if [[ "$TRAVIS_PHP_VERSION" = 5.* ]]; then (echo yes | pecl install -f apcu-4.0.8 && echo "apc.enable_cli = 1" >> $INI_FILE) || echo "Let's continue without apcu extension"; fi;
45-
- if [[ "$TRAVIS_PHP_VERSION" = 5.* ]]; then pecl install -f memcached-2.1.0 || echo "Let's continue without memcached extension"; fi;
46-
- if [[ "$TRAVIS_PHP_VERSION" = 5.* ]] && [ "$deps" = "no" ]; then (cd src/Symfony/Component/Debug/Resources/ext && phpize && ./configure && make && echo "extension = $(pwd)/modules/symfony_debug.so" >> $INI_FILE); fi;
47-
- if [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then echo "extension = ldap.so" >> $INI_FILE; fi;
48-
- if [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then php -i; else hhvm --php -r 'print_r($_SERVER);print_r(ini_get_all());'; fi;
49-
- if [ "$deps" != "skip" ]; then ./phpunit install; fi;
50-
- export PHPUNIT="$(readlink -f ./phpunit)"
34+
- if [[ ! $deps && ! $TRAVIS_PHP_VERSION = ${MIN_PHP%.*} && $TRAVIS_PHP_VERSION != hhvm && $TRAVIS_PULL_REQUEST != false ]]; then deps=skip; fi;
35+
- if [[ ! $deps && ! -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;
36+
- if [[ $TRAVIS_PHP_VERSION != hhvm ]]; then INI_FILE=~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini; else INI_FILE=/etc/hhvm/php.ini; fi;
37+
- echo memory_limit = -1 >> $INI_FILE
38+
- echo session.gc_probability = 0 >> $INI_FILE
39+
- if [[ $TRAVIS_PHP_VERSION = 5.* ]]; then echo extension = mongo.so >> $INI_FILE; fi;
40+
- if [[ $TRAVIS_PHP_VERSION = 5.* ]]; then echo extension = memcache.so >> $INI_FILE; fi;
41+
- if [[ $TRAVIS_PHP_VERSION = 5.* ]]; then (echo yes | pecl install -f apcu-4.0.10 && echo apc.enable_cli = 1 >> $INI_FILE) || echo "Let's continue without apcu extension"; fi;
42+
- if [[ $TRAVIS_PHP_VERSION = 5.* ]]; then pecl install -f memcached-2.1.0 || echo "Let's continue without memcached extension"; fi;
43+
- 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;
44+
- if [[ $TRAVIS_PHP_VERSION != hhvm ]]; then echo extension = ldap.so >> $INI_FILE; fi;
45+
- if [[ $TRAVIS_PHP_VERSION != hhvm ]]; then phpenv config-rm xdebug.ini; fi;
46+
- if [[ $deps != skip ]]; then composer self-update; fi;
47+
- if [[ $deps != skip ]]; then ./phpunit install; fi;
48+
- export PHPUNIT=$(readlink -f ./phpunit)
5149

5250
install:
53-
- if [ "$TRAVIS_BRANCH" = "master" ]; then export COMPOSER_ROOT_VERSION=dev-master; else export COMPOSER_ROOT_VERSION="$TRAVIS_BRANCH".x-dev; fi;
54-
- if [ "$deps" = "no" ]; then export SYMFONY_DEPRECATIONS_HELPER=strict; fi;
55-
- if [ "$deps" = "no" ]; then composer --prefer-source install; fi;
56-
- if [ "$deps" != "skip" ]; then COMPONENTS=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -printf '%h\n'); fi;
57-
- if [ "$deps" != "skip" ] && [ "$deps" != "no" ]; then php .travis.php $TRAVIS_COMMIT_RANGE $TRAVIS_BRANCH $COMPONENTS; fi;
51+
- if [[ $deps != skip ]]; then COMPONENTS=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -printf '%h\n'); fi;
52+
- if [[ $deps != skip && $deps ]]; then php .travis.php $TRAVIS_COMMIT_RANGE $TRAVIS_BRANCH $COMPONENTS; fi;
53+
- if [[ $deps = high && $TRAVIS_BRANCH = master ]]; then SYMFONY_VERSION=$(git branch -r | 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;
54+
- if [[ $deps = high && $TRAVIS_BRANCH = master ]]; then git fetch origin $SYMFONY_VERSION; git checkout -m FETCH_HEAD; fi;
55+
- if [[ $deps = high && ${SYMFONY_VERSION%.*} != $(git show $(git branch -r | 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;
56+
- 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 [[ $TRAVIS_PHP_VERSION != hhvm ]]; then php -i; else hhvm --php -r 'print_r($_SERVER);print_r(ini_get_all());'; fi;
5859

5960
script:
60-
- if [ "$deps" = "no" ]; then echo "$COMPONENTS" | parallel --gnu '$PHPUNIT --exclude-group tty,benchmark,intl-data {}'; fi;
61-
- if [ "$deps" = "no" ]; then echo -e "\\nRunning tests requiring tty"; $PHPUNIT --group tty; fi;
62-
- if [[ $deps = no && $TRAVIS_PHP_VERSION = 5.3 ]]; then echo -e "1\\n0" | parallel --gnu 'echo -e "\\nPHP --enable-sigchild enhanced={}" && ENHANCE_SIGCHLD={} php-5.3.9/sapi/cli/php .phpunit/phpunit-4.8/phpunit --colors=always src/Symfony/Component/Process/'; fi;
63-
- if [ "$deps" = "high" ]; then echo "$COMPONENTS" | parallel --gnu -j10% 'cd {}; composer --prefer-source update; $PHPUNIT --exclude-group tty,benchmark,intl-data,legacy'; fi;
64-
- 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" = "skip" ]; then echo 'This matrix line is skipped for pull requests.'; fi;
61+
- if [[ ! $deps ]]; then echo "$COMPONENTS" | parallel --gnu '$PHPUNIT --exclude-group tty,benchmark,intl-data {}'; fi;
62+
- if [[ ! $deps ]]; then echo -e "\\nRunning tests requiring tty"; $PHPUNIT --group tty; fi;
63+
- if [[ ! $deps && $TRAVIS_PHP_VERSION = ${MIN_PHP%.*} ]]; then echo -e "1\\n0" | parallel --gnu '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;
66+
- if [[ $deps = skip ]]; then echo This matrix line is skipped for pull requests.; fi;

appveyor.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ install:
2626
- IF %PHP%==1 cd ext
2727
- IF %PHP%==1 appveyor DownloadFile http://nebm.ist.utl.pt/~glopes/misc/intl_win/php_intl-3.0.0-5.3-nts-vc9-x86.zip
2828
- IF %PHP%==1 7z x php_intl-3.0.0-5.3-nts-vc9-x86.zip -y >nul
29-
- IF %PHP%==1 appveyor DownloadFile http://windows.php.net/downloads/pecl/releases/apcu/4.0.8/php_apcu-4.0.8-5.3-nts-vc9-x86.zip
30-
- IF %PHP%==1 7z x php_apcu-4.0.8-5.3-nts-vc9-x86.zip -y >nul
29+
- IF %PHP%==1 appveyor DownloadFile http://windows.php.net/downloads/pecl/releases/apcu/4.0.10/php_apcu-4.0.10-5.3-nts-vc9-x86.zip
30+
- IF %PHP%==1 7z x php_apcu-4.0.10-5.3-nts-vc9-x86.zip -y >nul
3131
- IF %PHP%==1 appveyor DownloadFile http://windows.php.net/downloads/pecl/releases/memcache/3.0.8/php_memcache-3.0.8-5.3-nts-vc9-x86.zip
3232
- IF %PHP%==1 7z x php_memcache-3.0.8-5.3-nts-vc9-x86.zip -y >nul
3333
- IF %PHP%==1 del /Q *.zip

phpunit

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ use Symfony\Component\Process\ProcessUtils;
1818
error_reporting(-1);
1919
require __DIR__.'/src/Symfony/Component/Process/ProcessUtils.php';
2020

21-
// PHPUnit 4.8 does not support PHP 7, while 5.0 requires PHP 5.6+
22-
$PHPUNIT_VERSION = PHP_VERSION_ID >= 70000 ? '5.0' : '4.8';
21+
// PHPUnit 4.8 does not support PHP 7, while 5.1 requires PHP 5.6+
22+
$PHPUNIT_VERSION = PHP_VERSION_ID >= 50600 ? '5.1' : '4.8';
2323
$PHPUNIT_DIR = __DIR__.'/.phpunit';
2424
$PHP = defined('PHP_BINARY') ? PHP_BINARY : 'php';
2525
$PHP = ProcessUtils::escapeArgument($PHP);
@@ -64,10 +64,6 @@ Symfony\Bridge\PhpUnit\TextUI\Command::main();
6464
EOPHP
6565
);
6666
chdir('..');
67-
if (file_exists('../src/Symfony/Bridge/PhpUnit') && `git diff --name-only HEAD^ -- ../src/Symfony/Bridge/PhpUnit`) {
68-
passthru(sprintf('\\' === DIRECTORY_SEPARATOR ? '(del /S /F /Q %s & rmdir %1$s) >nul': 'rm -rf %s', str_replace('/', DIRECTORY_SEPARATOR, "phpunit-$PHPUNIT_VERSION/vendor/symfony/phpunit-bridge")));
69-
symlink(realpath('../src/Symfony/Bridge/PhpUnit'), "phpunit-$PHPUNIT_VERSION/vendor/symfony/phpunit-bridge");
70-
}
7167
file_put_contents(".$PHPUNIT_VERSION.md5", md5_file(__FILE__));
7268
chdir($oldPwd);
7369

src/Symfony/Bridge/Doctrine/Form/ChoiceList/DoctrineChoiceLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ public function loadChoicesForValues(array $values, $value = null)
156156
// "INDEX BY" clause to the Doctrine query in the loader,
157157
// but I'm not sure whether that's doable in a generic fashion.
158158
foreach ($unorderedObjects as $object) {
159-
$objectsById[$this->idReader->getIdValue($object)] = $object;
159+
$objectsById[(string) $this->idReader->getIdValue($object)] = $object;
160160
}
161161

162162
foreach ($values as $i => $id) {
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Bridge\Doctrine\Tests\Fixtures;
13+
14+
use Doctrine\ORM\Mapping\Column;
15+
use Doctrine\ORM\Mapping\Entity;
16+
use Doctrine\ORM\Mapping\GeneratedValue;
17+
use Doctrine\ORM\Mapping\Id;
18+
19+
/** @Entity */
20+
class SingleStringCastableIdEntity
21+
{
22+
/**
23+
* @Id
24+
* @Column(type="string")
25+
* @GeneratedValue(strategy="NONE")
26+
*/
27+
protected $id;
28+
29+
/** @Column(type="string", nullable=true) */
30+
public $name;
31+
32+
public function __construct($id, $name)
33+
{
34+
$this->id = new StringCastableObjectIdentity($id);
35+
$this->name = $name;
36+
}
37+
38+
public function __toString()
39+
{
40+
return (string) $this->name;
41+
}
42+
}
43+
44+
class StringCastableObjectIdentity
45+
{
46+
protected $id;
47+
48+
public function __construct($id)
49+
{
50+
$this->id = $id;
51+
}
52+
53+
public function __toString()
54+
{
55+
return (string) $this->id;
56+
}
57+
}

src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
use Symfony\Bridge\Doctrine\Tests\Fixtures\CompositeStringIdEntity;
2525
use Symfony\Bridge\Doctrine\Tests\Fixtures\GroupableEntity;
2626
use Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdEntity;
27+
use Symfony\Bridge\Doctrine\Tests\Fixtures\SingleStringCastableIdEntity;
2728
use Symfony\Bridge\Doctrine\Tests\Fixtures\SingleStringIdEntity;
2829
use Symfony\Component\Form\ChoiceList\View\ChoiceGroupView;
2930
use Symfony\Component\Form\ChoiceList\View\ChoiceView;
@@ -40,6 +41,7 @@ class EntityTypeTest extends TypeTestCase
4041
const SINGLE_IDENT_NO_TO_STRING_CLASS = 'Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdNoToStringEntity';
4142
const SINGLE_STRING_IDENT_CLASS = 'Symfony\Bridge\Doctrine\Tests\Fixtures\SingleStringIdEntity';
4243
const SINGLE_ASSOC_IDENT_CLASS = 'Symfony\Bridge\Doctrine\Tests\Fixtures\SingleAssociationToIntIdEntity';
44+
const SINGLE_STRING_CASTABLE_IDENT_CLASS = 'Symfony\Bridge\Doctrine\Tests\Fixtures\SingleStringCastableIdEntity';
4345
const COMPOSITE_IDENT_CLASS = 'Symfony\Bridge\Doctrine\Tests\Fixtures\CompositeIntIdEntity';
4446
const COMPOSITE_STRING_IDENT_CLASS = 'Symfony\Bridge\Doctrine\Tests\Fixtures\CompositeStringIdEntity';
4547

@@ -67,6 +69,7 @@ protected function setUp()
6769
$this->em->getClassMetadata(self::SINGLE_IDENT_NO_TO_STRING_CLASS),
6870
$this->em->getClassMetadata(self::SINGLE_STRING_IDENT_CLASS),
6971
$this->em->getClassMetadata(self::SINGLE_ASSOC_IDENT_CLASS),
72+
$this->em->getClassMetadata(self::SINGLE_STRING_CASTABLE_IDENT_CLASS),
7073
$this->em->getClassMetadata(self::COMPOSITE_IDENT_CLASS),
7174
$this->em->getClassMetadata(self::COMPOSITE_STRING_IDENT_CLASS),
7275
);
@@ -606,6 +609,139 @@ public function testSubmitMultipleExpandedWithNegativeIntegerId()
606609
$this->assertFalse($field['2']->getData());
607610
}
608611

612+
public function testSubmitSingleNonExpandedStringCastableIdentifier()
613+
{
614+
$entity1 = new SingleStringCastableIdEntity(1, 'Foo');
615+
$entity2 = new SingleStringCastableIdEntity(2, 'Bar');
616+
617+
$this->persist(array($entity1, $entity2));
618+
619+
$field = $this->factory->createNamed('name', 'entity', null, array(
620+
'multiple' => false,
621+
'expanded' => false,
622+
'em' => 'default',
623+
'class' => self::SINGLE_STRING_CASTABLE_IDENT_CLASS,
624+
'choice_label' => 'name',
625+
));
626+
627+
$field->submit('2');
628+
629+
$this->assertTrue($field->isSynchronized());
630+
$this->assertSame($entity2, $field->getData());
631+
$this->assertSame('2', $field->getViewData());
632+
}
633+
634+
public function testSubmitSingleStringCastableIdentifierExpanded()
635+
{
636+
$entity1 = new SingleStringCastableIdEntity(1, 'Foo');
637+
$entity2 = new SingleStringCastableIdEntity(2, 'Bar');
638+
639+
$this->persist(array($entity1, $entity2));
640+
641+
$field = $this->factory->createNamed('name', 'entity', null, array(
642+
'multiple' => false,
643+
'expanded' => true,
644+
'em' => 'default',
645+
'class' => self::SINGLE_STRING_CASTABLE_IDENT_CLASS,
646+
'choice_label' => 'name',
647+
));
648+
649+
$field->submit('2');
650+
651+
$this->assertTrue($field->isSynchronized());
652+
$this->assertSame($entity2, $field->getData());
653+
$this->assertFalse($field['0']->getData());
654+
$this->assertTrue($field['1']->getData());
655+
$this->assertNull($field['0']->getViewData());
656+
$this->assertSame('2', $field['1']->getViewData());
657+
}
658+
659+
public function testSubmitMultipleNonExpandedStringCastableIdentifierForExistingData()
660+
{
661+
$entity1 = new SingleStringCastableIdEntity(1, 'Foo');
662+
$entity2 = new SingleStringCastableIdEntity(2, 'Bar');
663+
$entity3 = new SingleStringCastableIdEntity(3, 'Baz');
664+
665+
$this->persist(array($entity1, $entity2, $entity3));
666+
667+
$field = $this->factory->createNamed('name', 'entity', null, array(
668+
'multiple' => true,
669+
'expanded' => false,
670+
'em' => 'default',
671+
'class' => self::SINGLE_STRING_CASTABLE_IDENT_CLASS,
672+
'choice_label' => 'name',
673+
));
674+
675+
$existing = new ArrayCollection(array(0 => $entity2));
676+
677+
$field->setData($existing);
678+
$field->submit(array('1', '3'));
679+
680+
// entry with index 0 ($entity2) was replaced
681+
$expected = new ArrayCollection(array(0 => $entity1, 1 => $entity3));
682+
683+
$this->assertTrue($field->isSynchronized());
684+
$this->assertEquals($expected, $field->getData());
685+
// same object still, useful if it is a PersistentCollection
686+
$this->assertSame($existing, $field->getData());
687+
$this->assertSame(array('1', '3'), $field->getViewData());
688+
}
689+
690+
public function testSubmitMultipleNonExpandedStringCastableIdentifier()
691+
{
692+
$entity1 = new SingleStringCastableIdEntity(1, 'Foo');
693+
$entity2 = new SingleStringCastableIdEntity(2, 'Bar');
694+
$entity3 = new SingleStringCastableIdEntity(3, 'Baz');
695+
696+
$this->persist(array($entity1, $entity2, $entity3));
697+
698+
$field = $this->factory->createNamed('name', 'entity', null, array(
699+
'multiple' => true,
700+
'expanded' => false,
701+
'em' => 'default',
702+
'class' => self::SINGLE_STRING_CASTABLE_IDENT_CLASS,
703+
'choice_label' => 'name',
704+
));
705+
706+
$field->submit(array('1', '3'));
707+
708+
$expected = new ArrayCollection(array($entity1, $entity3));
709+
710+
$this->assertTrue($field->isSynchronized());
711+
$this->assertEquals($expected, $field->getData());
712+
$this->assertSame(array('1', '3'), $field->getViewData());
713+
}
714+
715+
public function testSubmitMultipleStringCastableIdentifierExpanded()
716+
{
717+
$entity1 = new SingleStringCastableIdEntity(1, 'Foo');
718+
$entity2 = new SingleStringCastableIdEntity(2, 'Bar');
719+
$entity3 = new SingleStringCastableIdEntity(3, 'Bar');
720+
721+
$this->persist(array($entity1, $entity2, $entity3));
722+
723+
$field = $this->factory->createNamed('name', 'entity', null, array(
724+
'multiple' => true,
725+
'expanded' => true,
726+
'em' => 'default',
727+
'class' => self::SINGLE_STRING_CASTABLE_IDENT_CLASS,
728+
'choice_label' => 'name',
729+
));
730+
731+
$field->submit(array('1', '3'));
732+
733+
$expected = new ArrayCollection(array($entity1, $entity3));
734+
735+
$this->assertTrue($field->isSynchronized());
736+
$this->assertEquals($expected, $field->getData());
737+
$this->assertTrue($field['0']->getData());
738+
$this->assertFalse($field['1']->getData());
739+
$this->assertTrue($field['2']->getData());
740+
$this->assertSame('1', $field['0']->getViewData());
741+
$this->assertNull($field['1']->getViewData());
742+
$this->assertSame('3', $field['2']->getViewData());
743+
}
744+
609745
public function testOverrideChoices()
610746
{
611747
$entity1 = new SingleIntIdEntity(1, 'Foo');

src/Symfony/Bundle/FrameworkBundle/composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"symfony/dependency-injection": "~2.8",
2323
"symfony/config": "~2.8",
2424
"symfony/event-dispatcher": "~2.8|~3.0.0",
25+
"symfony/finder": "~2.0,>=2.0.5|~3.0.0",
2526
"symfony/http-foundation": "~2.4.9|~2.5,>=2.5.4|~3.0.0",
2627
"symfony/http-kernel": "~2.8",
2728
"symfony/polyfill-mbstring": "~1.0",
@@ -40,7 +41,6 @@
4041
"symfony/console": "~2.8|~3.0.0",
4142
"symfony/css-selector": "~2.0,>=2.0.5|~3.0.0",
4243
"symfony/dom-crawler": "~2.0,>=2.0.5|~3.0.0",
43-
"symfony/finder": "~2.0,>=2.0.5|~3.0.0",
4444
"symfony/polyfill-intl-icu": "~1.0",
4545
"symfony/security": "~2.6|~3.0.0",
4646
"symfony/form": "~2.8",
@@ -53,7 +53,6 @@
5353
},
5454
"suggest": {
5555
"symfony/console": "For using the console commands",
56-
"symfony/finder": "For using the translation loader and cache warmer",
5756
"symfony/form": "For using forms",
5857
"symfony/serializer": "For using the serializer service",
5958
"symfony/validator": "For using validation",

src/Symfony/Component/HttpFoundation/BinaryFileResponse.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,10 @@ public function prepare(Request $request)
193193
// Use X-Sendfile, do not send any content.
194194
$type = $request->headers->get('X-Sendfile-Type');
195195
$path = $this->file->getRealPath();
196+
// Fall back to scheme://path for stream wrapped locations.
197+
if (false === $path) {
198+
$path = $this->file->getPathname();
199+
}
196200
if (strtolower($type) == 'x-accel-redirect') {
197201
// Do X-Accel-Mapping substitutions.
198202
// @link http://wiki.nginx.org/X-accel#X-Accel-Redirect

0 commit comments

Comments
 (0)