Merge branch '2.6' into 2.7

* 2.6:
  [FrameworkBundle] fix browserkit requirement
  [FrameworkBundle] fix expression-language requirement
  [TwigBridge] fix form requirement
  [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
This commit is contained in:
Nicolas Grekas 2014-12-26 00:30:25 +01:00
commit df0f2b23d5
7 changed files with 52 additions and 16 deletions

View File

@ -106,6 +106,9 @@ EOT
try {
$filesystem->symlink($relativeOriginDir, $targetDir);
if (!file_exists($targetDir)) {
throw new IOException('Symbolic link is broken');
}
$output->writeln('The assets were installed using symbolic links.');
} catch (IOException $e) {
if (!$input->getOption('relative')) {
@ -116,6 +119,9 @@ EOT
// try again without the relative option
try {
$filesystem->symlink($originDir, $targetDir);
if (!file_exists($targetDir)) {
throw new IOException('Symbolic link is broken');
}
$output->writeln('It looks like your system doesn\'t support relative symbolic links, so the assets were installed by using absolute symbolic links.');
} catch (IOException $e) {
$this->hardCopy($originDir, $targetDir);

View File

@ -20,7 +20,7 @@
"symfony/dependency-injection" : "~2.6,>=2.6.2",
"symfony/config" : "~2.4",
"symfony/event-dispatcher": "~2.5",
"symfony/http-foundation": "~2.4,>=2.4.9",
"symfony/http-foundation": "~2.4.9|~2.5,>=2.5.4",
"symfony/http-kernel": "~2.6",
"symfony/filesystem": "~2.3",
"symfony/routing": "~2.2",
@ -41,7 +41,7 @@
"symfony/security": "~2.6",
"symfony/form": "~2.6",
"symfony/class-loader": "~2.1",
"symfony/expression-language": "~2.4",
"symfony/expression-language": "~2.6",
"symfony/process": "~2.0,>=2.0.5",
"symfony/validator": "~2.5",
"symfony/yaml": "~2.0,>=2.0.5"

View File

@ -601,6 +601,10 @@ class SecurityExtension extends Extension
private function createRequestMatcher($container, $path = null, $host = null, $methods = array(), $ip = null, array $attributes = array())
{
if ($methods) {
$methods = array_map('strtoupper', (array) $methods);
}
$serialized = serialize(array($path, $host, $methods, $ip, $attributes));
$id = 'security.request_matcher.'.md5($serialized).sha1($serialized);
@ -608,10 +612,6 @@ class SecurityExtension extends Extension
return $this->requestMatchers[$id];
}
if ($methods) {
$methods = array_map('strtoupper', (array) $methods);
}
// only add arguments that are necessary
$arguments = array($path, $host, $methods, $ip, $attributes);
while (count($arguments) > 0 && !end($arguments)) {

View File

@ -27,6 +27,39 @@ use Symfony\Component\CssSelector\XPath\Translator;
* This component is a port of the Python cssselector library,
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
*
* Copyright (c) 2007-2012 Ian Bicking and contributors. See AUTHORS
* for more details.
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. Neither the name of Ian Bicking nor the names of its contributors may
* be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IAN BICKING OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @api

View File

@ -286,9 +286,7 @@ class Filesystem
*/
public function symlink($originDir, $targetDir, $copyOnWindows = false)
{
$onWindows = strtoupper(substr(php_uname('s'), 0, 3)) === 'WIN';
if ($onWindows && $copyOnWindows) {
if (defined('PHP_WINDOWS_VERSION_MAJOR') && $copyOnWindows) {
$this->mirror($originDir, $targetDir);
return;
@ -315,10 +313,6 @@ class Filesystem
}
throw new IOException(sprintf('Failed to create symbolic link from "%s" to "%s".', $originDir, $targetDir), 0, null, $targetDir);
}
if (!file_exists($targetDir)) {
throw new IOException(sprintf('Symbolic link "%s" is created but appears to be broken.', $targetDir), 0, null, $targetDir);
}
}
}

View File

@ -686,11 +686,14 @@ class FilesystemTest extends FilesystemTestCase
$file = $this->workspace.DIRECTORY_SEPARATOR.'file';
$link = $this->workspace.DIRECTORY_SEPARATOR.'link';
touch($file);
// $file does not exists right now: creating "broken" links is a wanted feature
$this->filesystem->symlink($file, $link);
$this->assertTrue(is_link($link));
// Create the linked file AFTER creating the link
touch($file);
$this->assertEquals($file, readlink($link));
}

View File

@ -17,7 +17,7 @@
],
"require": {
"php": ">=5.3.3",
"symfony/event-dispatcher": "2.5.*,>2.5.8|~2.6,>2.6.1",
"symfony/event-dispatcher": "~2.5.9|~2.6,>=2.6.2",
"symfony/http-foundation": "~2.5,>=2.5.4",
"symfony/debug": "~2.6",
"psr/log": "~1.0"