Skip to content

Commit 85814de

Browse files
Merge branch '2.3' into 2.7
* 2.3: 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 [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 src/Symfony/Bundle/SecurityBundle/Templating/Helper/LogoutUrlHelper.php
2 parents 6499a2c + f765956 commit 85814de

File tree

7 files changed

+64
-48
lines changed

7 files changed

+64
-48
lines changed

.travis.yml

Lines changed: 38 additions & 36 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,45 +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 php -i; else hhvm --php -r 'print_r($_SERVER);print_r(ini_get_all());'; fi;
48-
- if [ "$deps" != "skip" ]; then ./phpunit install; fi;
49-
- 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)
5049

5150
install:
52-
- if [ "$TRAVIS_BRANCH" = "master" ]; then export COMPOSER_ROOT_VERSION=dev-master; else export COMPOSER_ROOT_VERSION="$TRAVIS_BRANCH".x-dev; fi;
53-
- if [ "$deps" = "no" ]; then export SYMFONY_DEPRECATIONS_HELPER=strict; fi;
54-
- if [ "$deps" = "no" ]; then composer --prefer-source install; fi;
55-
- if [ "$deps" != "skip" ]; then COMPONENTS=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -printf '%h\n'); fi;
56-
- 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;
5759

5860
script:
59-
- if [ "$deps" = "no" ]; then echo "$COMPONENTS" | parallel --gnu '$PHPUNIT --exclude-group tty,benchmark,intl-data {}'; fi;
60-
- if [ "$deps" = "no" ]; then echo -e "\\nRunning tests requiring tty"; $PHPUNIT --group tty; fi;
61-
- 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;
62-
- if [ "$deps" = "high" ]; then echo "$COMPONENTS" | parallel --gnu -j10% 'cd {}; composer --prefer-source update; $PHPUNIT --exclude-group tty,benchmark,intl-data'; fi;
63-
- 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;
64-
- 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/Bundle/FrameworkBundle/composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"symfony/dependency-injection": "~2.6,>=2.6.2",
2222
"symfony/config": "~2.4",
2323
"symfony/event-dispatcher": "~2.5",
24+
"symfony/finder": "~2.0,>=2.0.5",
2425
"symfony/http-foundation": "~2.4.9|~2.5,>=2.5.4",
2526
"symfony/http-kernel": "~2.7",
2627
"symfony/filesystem": "~2.3",
@@ -37,7 +38,6 @@
3738
"symfony/console": "~2.7",
3839
"symfony/css-selector": "~2.0,>=2.0.5",
3940
"symfony/dom-crawler": "~2.0,>=2.0.5",
40-
"symfony/finder": "~2.0,>=2.0.5",
4141
"symfony/intl": "~2.3",
4242
"symfony/security": "~2.6",
4343
"symfony/form": "~2.7,>=2.7.2",
@@ -49,7 +49,6 @@
4949
},
5050
"suggest": {
5151
"symfony/console": "For using the console commands",
52-
"symfony/finder": "For using the translation loader and cache warmer",
5352
"symfony/form": "For using forms",
5453
"symfony/serializer": "For using the serializer service",
5554
"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

src/Symfony/Component/HttpFoundation/Tests/BinaryFileResponseTest.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,13 +153,16 @@ public function provideInvalidRanges()
153153
);
154154
}
155155

156-
public function testXSendfile()
156+
/**
157+
* @dataProvider provideXSendfileFiles
158+
*/
159+
public function testXSendfile($file)
157160
{
158161
$request = Request::create('/');
159162
$request->headers->set('X-Sendfile-Type', 'X-Sendfile');
160163

161164
BinaryFileResponse::trustXSendfileTypeHeader();
162-
$response = BinaryFileResponse::create(__DIR__.'/../README.md', 200, array('Content-Type' => 'application/octet-stream'));
165+
$response = BinaryFileResponse::create($file, 200, array('Content-Type' => 'application/octet-stream'));
163166
$response->prepare($request);
164167

165168
$this->expectOutputString('');
@@ -168,6 +171,14 @@ public function testXSendfile()
168171
$this->assertContains('README.md', $response->headers->get('X-Sendfile'));
169172
}
170173

174+
public function provideXSendfileFiles()
175+
{
176+
return array(
177+
array(__DIR__.'/../README.md'),
178+
array('file://'.__DIR__.'/../README.md'),
179+
);
180+
}
181+
171182
/**
172183
* @dataProvider getSampleXAccelMappings
173184
*/

src/Symfony/Component/HttpKernel/Bundle/Bundle.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,10 @@ public function registerCommands(Application $application)
166166
return;
167167
}
168168

169+
if (!class_exists('Symfony\Component\Finder\Finder')) {
170+
throw new \RuntimeException('You need the symfony/finder component to register bundle commands.');
171+
}
172+
169173
$finder = new Finder();
170174
$finder->files()->name('*Command.php')->in($dir);
171175

0 commit comments

Comments
 (0)