8000 Merge branch '2.7' · symfony/symfony@d6af4d6 · GitHub
[go: up one dir, main page]

Skip to content

Commit d6af4d6

Browse files
Merge branch '2.7'
* 2.7: [travis] reorder matrix + prevent "Killed" jobs [FrameworkBundle] Optimize validator registration [FrameworkBundle] fix browserkit requirement [FrameworkBundle] fix expression-language requirement [TwigBridge] fix form requirement [HttpFoundation] removed wrong HTTP header [Filesystem] restore ability to create broken symlinks [FrameworkBundle] fix http-foundation requirement [CssSelector] added the license of the Python library we ported to PHP [SecurityBundle] avoid unneeded work
2 parents f333cb2 + f5407b7 commit d6af4d6

File tree

11 files changed

+80
-57
lines changed

11 files changed

+80
-57
lines changed

.travis.yml

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
language: php
22

3-
php:
4-
- 5.3.3
5-
- 5.3
6-
- 5.4
7-
- 5.5
8-
- 5.6
9-
- hhvm-nightly
10-
113
matrix:
12-
allow_failures:
13-
- php: hhvm-nightly
144
include:
15-
- php: 5.5
16-
env: components=high
175
- php: 5.3.3
186
env: components=low
7+
- php: 5.6
8+
env: components=high
9+
- php: 5.3.3
10+
- php: 5.3
11+
- php: 5.4
12+
- php: 5.5
13+
- php: 5.6
14+
- php: hhvm-nightly
15+
allow_failures:
16+
- php: hhvm-nightly
17+
fast_finish: true
1918

2019
services: mongodb
2120

@@ -26,12 +25,12 @@ env:
2625
before_install:
2726
- travis_retry sudo apt-get install parallel
2827
- composer self-update
29-
- if [ "$TRAVIS_PHP_VERSION" != "hhvm-nightly" ]; then echo ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini; fi;
30-
- if [ "$TRAVIS_PHP_VERSION" != "hhvm-nightly" ]; then echo "" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini; fi;
28+
- if [ "$TRAVIS_PHP_VERSION" != "hhvm-nightly" ]; then phpenv config-rm xdebug.ini; fi;
3129
- if [ "$TRAVIS_PHP_VERSION" != "hhvm-nightly" ]; then echo "extension = mongo.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;
3230
- if [ "$TRAVIS_PHP_VERSION" != "hhvm-nightly" ] && [ $(php -r "echo PHP_MINOR_VERSION;") -le 4 ]; then echo "extension = apc.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;
3331
- if [ "$TRAVIS_PHP_VERSION" != "hhvm-nightly" ]; then pecl install -f memcached-2.1.0; fi;
3432
- if [ "$TRAVIS_PHP_VERSION" != "hhvm-nightly" ]; then echo "extension = memcache.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;
33+
- if [ "$TRAVIS_PHP_VERSION" != "hhvm-nightly" ]; then php -i; fi;
3534
- sudo locale-gen fr_FR.UTF-8 && sudo update-locale
3635
# - if [ "$TRAVIS_PHP_VERSION" != "5.3.3" ]; then phpunit --self-update; fi;
3736

@@ -42,4 +41,4 @@ script:
4241
- if [ "$components" = "no" ]; then ls -d src/Symfony/*/* | parallel --gnu --keep-order 'echo "Running {} tests"; phpunit --exclude-group tty,benchmark,intl-data {};'; fi;
4342
- if [ "$components" = "no" ]; then echo "Running tests requiring tty"; phpunit --group tty; fi;
4443
- if [ "$components" = "high" ]; then find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist | sed 's#\(.*\)/.*#\1#' | parallel --gnu --keep-order 'echo "Running {} tests"; cd {}; COMPOSER_ROOT_VERSION=dev-master composer --prefer-source --dev install; phpunit --exclude-group tty,benchmark,intl-data;'; fi;
45-
- if [ "$components" = "low" ]; then find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist | sed 's#\(.*\)/.*#\1#' | parallel --gnu --keep-order 'echo "Running {} tests"; cd {}; COMPOSER_ROOT_VERSION=dev-master composer --prefer-source --dev --prefer-lowest --prefer-stable update; phpunit --exclude-group tty,benchmark,intl-data;'; fi;
44+
- if [ "$components" = "low" ]; then find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist | sed 's#\(.*\)/.*#\1#' | parallel --gnu --keep-order -j50% 'echo "Running {} tests"; cd {}; COMPOSER_ROOT_VERSION=dev-master composer --prefer-source --dev --prefer-lowest --prefer-stable update; phpunit --exclude-group tty,benchmark,intl-data;'; fi;

src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ protected function execute(InputInterface $input, OutputInterface $output)
106106

107107
try {
108108
$filesystem->symlink($relativeOriginDir, $targetDir);
109+
if (!file_exists($targetDir)) {
110+
throw new IOException('Symbolic link is broken');
111+
}
109112
$output->writeln('The assets were installed using symbolic links.');
110113
} catch (IOException $e) {
111114
if (!$input->getOption('relative')) {
@@ -116,6 +119,9 @@ protected function execute(InputInterface $input, OutputInterface $output)
116119
// try again without the relative option
117120
try {
118121
$filesystem->symlink($originDir, $targetDir);
122+
if (!file_exists($targetDir)) {
123+
throw new IOException('Symbolic link is broken');
124+
}
119125
$output->writeln('It looks like your system doesn\'t support relative symbolic links, so the assets were installed by using absolute symbolic links.');
120126
} catch (IOException $e) {
121127
$this->hardCopy($originDir, $targetDir);

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ class FrameworkExtension extends Extension
4040
*
4141
* @param array $configs
4242
* @param ContainerBuilder $container
43+
* @throws LogicException
4344
*/
4445
public function load(array $configs, ContainerBuilder $container)
4546
{
@@ -711,9 +712,7 @@ private function registerValidationConfiguration(array $config, ContainerBuilder
711712

712713
$container->setParameter('validator.translation_domain', $config['translation_domain']);
713714

714-
$xmlMappings = $this->getValidatorXmlMappingFiles($container);
715-
$yamlMappings = $this->getValidatorYamlMappingFiles($container);
716-
715+
list($xmlMappings, $yamlMappings) = $this->getValidatorMappingFiles($container);
717716
if (count($xmlMappings) > 0) {
718717
$validatorBuilder->addMethodCall('addXmlMappings', array($xmlMappings));
719718
}
@@ -766,35 +765,28 @@ private function registerValidationConfiguration(array $config, ContainerBuilder
766765
$container->setParameter('validator.api', $api);
767766
}
768767

769-
private function getValidatorXmlMappingFiles(ContainerBuilder $container)
768+
private function getValidatorMappingFiles(ContainerBuilder $container)
770769
{
771-
$files = array();
770+
$files = array(array(), array());
772771

773772
if (interface_exists('Symfony\Component\Form\FormInterface')) {
774773
$reflClass = new \ReflectionClass('Symfony\Component\Form\FormInterface');
775-
$files[] = dirname($reflClass->getFileName()).'/Resources/config/validation.xml';
776-
$container->addResource(new FileResource($files[0]));
774+
$files[0][] = dirname($reflClass->getFileName()).'/Resources/config/validation.xml';
775+
$container->addResource(new FileResource($files[0][0]));
777776
}
778777

779-
foreach ($container->getParameter('kernel.bundles') as $bundle) {
778+
$bundles = $container->getParameter('kernel.bundles');
779+
foreach ($bundles as $bundle) {
780780
$reflection = new \ReflectionClass($bundle);
781-
if (is_file($file = dirname($reflection->getFilename()).'/Resources/config/validation.xml')) {
782-
$files[] = realpath($file);
781+
$dirname = dirname($reflection->getFilename());
782+
783+
if (is_file($file = $dirname.'/Resources/config/validation.xml')) {
784+
$files[0][] = realpath($file);
783785
$container->addResource(new FileResource($file));
784786
}
785-
}
786787

787-
return $files;
788-
}
789-
790-
private function getValidatorYamlMappingFiles(ContainerBuilder $container)
791-
{
792-
$files = array();
793-
794-
foreach ($container->getParameter('kernel.bundles') as $bundle) {
795-
$reflection = new \ReflectionClass($bundle);
796-
if (is_file($file = dirname($reflection->getFilename()).'/Resources/config/validation.yml')) {
797-
$files[] = realpath($file);
788+
if (is_file($file = $dirname.'/Resources/config/validation.yml')) {
789+
$files[1][] = realpath($file);
798790
$container->addResource(new FileResource($file));
799791
}
800792
}

src/Symfony/Bundle/FrameworkBundle/composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"symfony/dependency-injection" : "~2.6,>=2.6.2",
2121
"symfony/config" : "~2.4",
2222
"symfony/event-dispatcher": "~2.5",
23-
"symfony/http-foundation": "~2.4,>=2.4.9",
23+
"symfony/http-foundation": "~2.4.9|~2.5,>=2.5.4",
2424
"symfony/http-kernel": "~2.6",
2525
"symfony/filesystem": "~2.3",
2626
"symfony/routing": "~2.2",
@@ - F438 41,7 +41,7 @@
4141
"symfony/security": "~2.6",
4242
"symfony/form": "~2.6",
4343
"symfony/class-loader": "~2.1",
44-
"symfony/expression-language": "~2.4",
44+
"symfony/expression-language": "~2.6",
4545
"symfony/process": "~2.0,>=2.0.5",
4646
"symfony/validator": "~2.5",
4747
"symfony/yaml": "~2.0,>=2.0.5"

src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -601,17 +601,17 @@ private function createExpression($container, $expression)
601601

602602
private function createRequestMatcher($container, $path = null, $host = null, $methods = array(), $ip = null, array $attributes = array())
603603
{
604+
if ($methods) {
605+
$methods = array_map('strtoupper', (array) $methods);
606+
}
607+
604608
$serialized = serialize(array($path, $host, $methods, $ip, $attributes));
605609
$id = 'security.request_matcher.'.md5($serialized).sha1($serialized);
606610

607611
if (isset($this->requestMatchers[$id])) {
608612
return $this->requestMatchers[$id];
609613
}
610614

611-
if ($methods) {
612-
$methods = array_map('strtoupper', (array) $methods);
613-
}
614-
615615
// only add arguments that are necessary
616616
$arguments = array($path, $host, $methods, $ip, $attributes);
617617
while (count($arguments) > 0 && !end($arguments)) {

src/Symfony/Component/CssSelector/CssSelector.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,39 @@
2727
* This component is a port of the Python cssselector library,
2828
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
2929
*
30+
* Copyright (c) 2007-2012 Ian Bicking and contributors. See AUTHORS
31+
* for more details.
32+
*
33+
* All rights reserved.
34+
*
35+
* Redistribution and use in source and binary forms, with or without
36+
* modification, are permitted provided that the following conditions are
37+
* met:
38+
*
39+
* 1. Redistributions of source code must retain the above copyright
40+
* notice, this list of conditions and the following disclaimer.
41+
*
42+
* 2. Redistributions in binary form must reproduce the above copyright
43+
* notice, this list of conditions and the following disclaimer in
44+
* the documentation and/or other materials provided with the
45+
* distribution.
46+
*
47+
* 3. Neither the name of Ian Bicking nor the names of its contributors may
48+
* be used to endorse or promote products derived from this software
49+
* without specific prior written permission.
50+
*
51+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
52+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
53+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
54+
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IAN BICKING OR
55+
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
56+
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
57+
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
58+
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
59+
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
60+
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
61+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
62+
*
3063
* @author Fabien Potencier <fabien@symfony.com>
3164
*
3265
* @api

src/Symfony/Component/Filesystem/Filesystem.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -286,9 +286,7 @@ public function rename($origin, $target, $overwrite = false)
286286
*/
287287
public function symlink($originDir, $targetDir, $copyOnWindows = false)
288288
{
289-
$onWindows = strtoupper(substr(php_uname('s'), 0, 3)) === 'WIN';
290-
291-
if ($onWindows && $copyOnWindows) {
289+
if (defined('PHP_WINDOWS_VERSION_MAJOR') && $copyOnWindows) {
292290
$this->mirror($originDir, $targetDir);
293291

294292
return;
@@ -315,10 +313,6 @@ public function symlink($originDir, $targetDir, $copyOnWindows = false)
315313
}
316314
throw new IOException(sprintf('Failed to create symbolic link from "%s" to "%s".', $originDir, $targetDir), 0, null, $targetDir);
317315
}
318-
319-
if (!file_exists($targetDir)) {
320-
throw new IOException(sprintf('Symbolic link "%s" is created but appears to be broken.', $targetDir), 0, null, $targetDir);
321-
}
322316
}
323317
}
324318

src/Symfony/Component/Filesystem/Tests/FilesystemTest.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -686,11 +686,14 @@ public function testSymlink()
686686
$file = $this->workspace.DIRECTORY_SEPARATOR.'file';
687687
$link = $this->workspace.DIRECTORY_SEPARATOR.'link';
688688

689-
touch($file);
690-
689+
// $file does not exists right now: creating "broken" links is a wanted feature
691690
$this->filesystem->symlink($file, $link);
692691

693692
$this->assertTrue(is_link($link));
693+
694+
// Create the linked file AFTER creating the link
695+
touch($file);
696+
694697
$this->assertEquals($file, readlink($link));
695698
}
696699

src/Symfony/Component/HttpFoundation/BinaryFileResponse.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,6 @@ public function prepare(Request $request)
171171
{
172172
$this->headers->set('Content-Length', $this->file->getSize());
173173
$this->headers->set('Accept-Ranges', 'bytes');
174-
$this->headers->set('Content-Transfer-Encoding', 'binary');
175174

176175
if (!$this->headers->has('Content-Type')) {
177176
$this->headers->set('Content-Type', $this->file->getMimeType() ?: 'application/octet-stream');

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ public function testRequests($requestRange, $offset, $length, $responseRange)
7777
$response->sendContent();
7878

7979
$this->assertEquals(206, $response->getStatusCode());
80-
$this->assertEquals('binary', $response->headers->get('Content-Transfer-Encoding'));
81 B83A 80
$this->assertEquals($responseRange, $response->headers->get('Content-Range'));
8281
}
8382

@@ -113,7 +112,6 @@ public function testFullFileRequests($requestRange)
113112
$response->sendContent();
114113

115114
$this->assertEquals(200, $response->getStatusCode());
116-
$this->assertEquals('binary', $response->headers->get('Content-Transfer-Encoding'));
117115
}
118116

119117
public function provideFullFileRanges()
@@ -144,7 +142,6 @@ public function testInvalidRequests($requestRange)
144142
$response->sendContent();
145143

146144
$this->assertEquals(416, $response->getStatusCode());
147-
$this->assertEquals('binary', $response->headers->get('Content-Transfer-Encoding'));
148145
#$this->assertEquals('', $response->headers->get('Content-Range'));
149146
}
150147

src/Symfony/Component/HttpKernel/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
],
1818
"require": {
1919
"php": ">=5.3.3",
20-
"symfony/event-dispatcher": "2.5.*,>2.5.8|~2.6,>2.6.1",
20+
"symfony/event-dispatcher": "~2.5.9|~2.6,>=2.6.2",
2121
"symfony/http-foundation": "~2.5,>=2.5.4",
2222
"symfony/debug": "~2.6",
2323
"psr/log": "~1.0"

0 commit comments

Comments
 (0)
0