Merge branch '2.3' into 2.5
* 2.3: No global state for isolated tests and other fixes [TwigBundle] Moved the setting of the default escaping strategy from the Twig engine to the Twig environment [Debug] fix checkip6 [HttpFoundation] fixed error when an IP in the X-Forwarded-For HTTP header contains a port Update the note about origins of the CssSelector component. Use the correct cssselect library name in docblocks.
This commit is contained in:
commit
286b65d676
|
@ -38,7 +38,7 @@ install:
|
|||
- if [ "$components" = "no" ]; then COMPOSER_ROOT_VERSION=dev-master composer --prefer-source --dev install; fi;
|
||||
|
||||
script:
|
||||
- if [ "$components" = "no" ]; then ls -d src/Symfony/*/* | parallel --gnu --keep-order 'echo "Running {} tests"; phpunit --exclude-group tty,benchmark,intl-data {};'; fi;
|
||||
- if [ "$components" = "no" ]; then echo "Running tests requiring tty"; phpunit --group tty; fi;
|
||||
- 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;
|
||||
- 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;
|
||||
- if [ "$components" = "no" ]; then ls -d src/Symfony/*/* | parallel --gnu --keep-order 'echo -e "\\nRunning {} tests"; phpunit --exclude-group tty,benchmark,intl-data {} || (echo -e "\\e[41mKO\\e[0m {}" && $(exit 1));'; fi;
|
||||
- if [ "$components" = "no" ]; then echo -e "\\nRunning tests requiring tty"; phpunit --group tty || (echo -e "\\e[41mKO\\e[0m tty group" && $(exit 1)); fi;
|
||||
- if [ "$components" = "high" ]; then find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist | sed 's#\(.*\)/.*#\1#' | parallel --gnu --keep-order -j25% 'echo -e "\\nRunning {} tests"; cd {}; COMPOSER_ROOT_VERSION=dev-master composer --prefer-source --dev update; phpunit --exclude-group tty,benchmark,intl-data || (echo -e "\\e[41mKO\\e[0m {}" && $(exit 1));'; fi;
|
||||
- if [ "$components" = "low" ]; then find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist | sed 's#\(.*\)/.*#\1#' | parallel --gnu --keep-order -j25% 'echo -e "\\nRunning {} tests"; cd {}; COMPOSER_ROOT_VERSION=dev-master composer --prefer-source --dev --prefer-lowest --prefer-stable update; phpunit --exclude-group tty,benchmark,intl-data || (echo -e "\\e[41mKO\\e[0m {}" && $(exit 1));'; fi;
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
],
|
||||
"require": {
|
||||
"php": ">=5.3.3",
|
||||
"doctrine/common": "~2.2",
|
||||
"twig/twig": "~1.12",
|
||||
"doctrine/common": "~2.3",
|
||||
"twig/twig": "~1.12,>=1.12.3",
|
||||
"psr/log": "~1.0"
|
||||
},
|
||||
"replace": {
|
||||
|
|
|
@ -124,7 +124,9 @@ class Configuration implements ConfigurationInterface
|
|||
$rootNode
|
||||
->fixXmlConfig('path')
|
||||
->children()
|
||||
->scalarNode('autoescape')->end()
|
||||
->variableNode('autoescape')
|
||||
->defaultValue(array('Symfony\Bundle\TwigBundle\TwigDefaultEscapingStrategy', 'guess'))
|
||||
->end()
|
||||
->scalarNode('autoescape_service')->defaultNull()->end()
|
||||
->scalarNode('autoescape_service_method')->defaultNull()->end()
|
||||
->scalarNode('base_template_class')->example('Twig_Template')->end()
|
||||
|
|
|
@ -109,12 +109,9 @@ class TwigExtension extends Extension
|
|||
}
|
||||
|
||||
if (isset($config['autoescape_service']) && isset($config['autoescape_service_method'])) {
|
||||
$container->findDefinition('templating.engine.twig')->addMethodCall('setDefaultEscapingStrategy', array(array(new Reference($config['autoescape_service']), $config['autoescape_service_method'])));
|
||||
|
||||
unset($config['autoescape_service'], $config['autoescape_service_method']);
|
||||
} elseif (!isset($config['autoescape'])) {
|
||||
$container->findDefinition('templating.engine.twig')->addMethodCall('setDefaultEscapingStrategy', array(array(new Reference('templating.engine.twig'), 'guessDefaultEscapingStrategy')));
|
||||
$config['autoescape'] = array(new Reference($config['autoescape_service']), $config['autoescape_service_method']);
|
||||
}
|
||||
unset($config['autoescape_service'], $config['autoescape_service_method']);
|
||||
|
||||
$container->setParameter('twig.options', $config);
|
||||
|
||||
|
|
|
@ -95,7 +95,8 @@ class TwigExtensionTest extends TestCase
|
|||
$this->loadFromFile($container, 'customTemplateEscapingGuesser', $format);
|
||||
$this->compileContainer($container);
|
||||
|
||||
$this->assertTemplateEscapingGuesserDefinition($container, 'my_project.some_bundle.template_escaping_guesser', 'guess');
|
||||
$options = $container->getParameter('twig.options');
|
||||
$this->assertEquals(array(new Reference('my_project.some_bundle.template_escaping_guesser'), 'guess'), $options['autoescape']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -108,7 +109,8 @@ class TwigExtensionTest extends TestCase
|
|||
$this->loadFromFile($container, 'empty', $format);
|
||||
$this->compileContainer($container);
|
||||
|
||||
$this->assertTemplateEscapingGuesserDefinition($container, 'templating.engine.twig', 'guessDefaultEscapingStrategy');
|
||||
$options = $container->getParameter('twig.options');
|
||||
$this->assertEquals(array('Symfony\Bundle\TwigBundle\TwigDefaultEscapingStrategy', 'guess'), $options['autoescape']);
|
||||
}
|
||||
|
||||
public function testGlobalsWithDifferentTypesAndValues()
|
||||
|
@ -219,18 +221,4 @@ class TwigExtensionTest extends TestCase
|
|||
|
||||
$loader->load($file.'.'.$format);
|
||||
}
|
||||
|
||||
private function assertTemplateEscapingGuesserDefinition(ContainerBuilder $container, $serviceId, $serviceMethod)
|
||||
{
|
||||
$def = $container->getDefinition('templating.engine.twig');
|
||||
|
||||
$this->assertCount(1, $def->getMethodCalls());
|
||||
|
||||
foreach ($def->getMethodCalls() as $call) {
|
||||
if ('setDefaultEscapingStrategy' === $call[0]) {
|
||||
$this->assertSame($serviceId, (string) $call[1][0][0]);
|
||||
$this->assertSame($serviceMethod, $call[1][0][1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Bundle\TwigBundle;
|
||||
|
||||
/**
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
class TwigDefaultEscapingStrategy
|
||||
{
|
||||
public static function guess($filename)
|
||||
{
|
||||
// remove .twig
|
||||
$filename = substr($filename, 0, -5);
|
||||
|
||||
// get the format
|
||||
$format = substr($filename, strrpos($filename, '.') + 1);
|
||||
|
||||
if ('js' === $format) {
|
||||
return 'js';
|
||||
}
|
||||
|
||||
if ('txt' === $format) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return 'html';
|
||||
}
|
||||
}
|
|
@ -41,28 +41,21 @@ class TwigEngine extends BaseEngine implements EngineInterface
|
|||
$this->locator = $locator;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Deprecated since version 2.3, to be removed in 3.0. Inject the escaping
|
||||
* strategy on Twig_Environment instead
|
||||
*/
|
||||
public function setDefaultEscapingStrategy($strategy)
|
||||
{
|
||||
$this->environment->getExtension('escaper')->setDefaultStrategy($strategy);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Deprecated since version 2.3, to be removed in 3.0. Use TwigDefaultEscapingStrategy instead.
|
||||
*/
|
||||
public function guessDefaultEscapingStrategy($filename)
|
||||
{
|
||||
// remove .twig
|
||||
$filename = substr($filename, 0, -5);
|
||||
|
||||
// get the format
|
||||
$format = substr($filename, strrpos($filename, '.') + 1);
|
||||
|
||||
if ('js' === $format) {
|
||||
return 'js';
|
||||
}
|
||||
|
||||
if ('txt' === $format) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return 'html';
|
||||
return TwigDefaultEscapingStrategy::guess($filename);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -24,7 +24,7 @@ use Symfony\Component\CssSelector\XPath\Translator;
|
|||
*
|
||||
* $xpath = CssSelector::toXpath('h1.foo');
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* Copyright (c) 2007-2012 Ian Bicking and contributors. See AUTHORS
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Symfony\Component\CssSelector\Exception;
|
|||
/**
|
||||
* Interface for exceptions.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Symfony\Component\CssSelector\Exception;
|
|||
/**
|
||||
* ParseException is thrown when a CSS selector syntax is not valid.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Symfony\Component\CssSelector\Exception;
|
|||
/**
|
||||
* ParseException is thrown when a CSS selector syntax is not valid.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Symfony\Component\CssSelector\Exception;
|
|||
/**
|
||||
* ParseException is thrown when a CSS selector syntax is not valid.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
|
|
|
@ -16,7 +16,7 @@ use Symfony\Component\CssSelector\Parser\Token;
|
|||
/**
|
||||
* ParseException is thrown when a CSS selector syntax is not valid.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Symfony\Component\CssSelector\Node;
|
|||
/**
|
||||
* Abstract base node class.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Symfony\Component\CssSelector\Node;
|
|||
/**
|
||||
* Represents a "<selector>[<namespace>|<attribute> <operator> <value>]" node.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Symfony\Component\CssSelector\Node;
|
|||
/**
|
||||
* Represents a "<selector>.<name>" node.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Symfony\Component\CssSelector\Node;
|
|||
/**
|
||||
* Represents a combined node.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Symfony\Component\CssSelector\Node;
|
|||
/**
|
||||
* Represents a "<namespace>|<element>" node.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -16,7 +16,7 @@ use Symfony\Component\CssSelector\Parser\Token;
|
|||
/**
|
||||
* Represents a "<selector>:<name>(<arguments>)" node.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Symfony\Component\CssSelector\Node;
|
|||
/**
|
||||
* Represents a "<selector>#<id>" node.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Symfony\Component\CssSelector\Node;
|
|||
/**
|
||||
* Represents a "<selector>:not(<identifier>)" node.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Symfony\Component\CssSelector\Node;
|
|||
/**
|
||||
* Interface for nodes.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Symfony\Component\CssSelector\Node;
|
|||
/**
|
||||
* Represents a "<selector>:<identifier>" node.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Symfony\Component\CssSelector\Node;
|
|||
/**
|
||||
* Represents a "<selector>(::|:)<pseudoElement>" node.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Symfony\Component\CssSelector\Node;
|
|||
/**
|
||||
* Represents a node specificity.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @see http://www.w3.org/TR/selectors/#specificity
|
||||
|
|
|
@ -17,7 +17,7 @@ use Symfony\Component\CssSelector\Parser\TokenStream;
|
|||
/**
|
||||
* CSS selector comment handler.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -17,7 +17,7 @@ use Symfony\Component\CssSelector\Parser\TokenStream;
|
|||
/**
|
||||
* CSS selector handler interface.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -20,7 +20,7 @@ use Symfony\Component\CssSelector\Parser\Tokenizer\TokenizerPatterns;
|
|||
/**
|
||||
* CSS selector comment handler.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -20,7 +20,7 @@ use Symfony\Component\CssSelector\Parser\Tokenizer\TokenizerPatterns;
|
|||
/**
|
||||
* CSS selector comment handler.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -19,7 +19,7 @@ use Symfony\Component\CssSelector\Parser\Tokenizer\TokenizerPatterns;
|
|||
/**
|
||||
* CSS selector comment handler.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -22,7 +22,7 @@ use Symfony\Component\CssSelector\Parser\Tokenizer\TokenizerPatterns;
|
|||
/**
|
||||
* CSS selector comment handler.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -18,7 +18,7 @@ use Symfony\Component\CssSelector\Parser\TokenStream;
|
|||
/**
|
||||
* CSS selector whitespace handler.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -18,7 +18,7 @@ use Symfony\Component\CssSelector\Parser\Tokenizer\Tokenizer;
|
|||
/**
|
||||
* CSS selector parser.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -16,7 +16,7 @@ use Symfony\Component\CssSelector\Node\SelectorNode;
|
|||
/**
|
||||
* CSS selector parser interface.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Symfony\Component\CssSelector\Parser;
|
|||
/**
|
||||
* CSS selector reader.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -19,7 +19,7 @@ use Symfony\Component\CssSelector\Parser\ParserInterface;
|
|||
/**
|
||||
* CSS selector class parser shortcut.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -18,7 +18,7 @@ use Symfony\Component\CssSelector\Parser\ParserInterface;
|
|||
/**
|
||||
* CSS selector element parser shortcut.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -22,7 +22,7 @@ use Symfony\Component\CssSelector\Parser\ParserInterface;
|
|||
* - The parser fails to parse an empty string.
|
||||
* - In the previous version, an empty string matches each tags.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -19,7 +19,7 @@ use Symfony\Component\CssSelector\Parser\ParserInterface;
|
|||
/**
|
||||
* CSS selector hash parser shortcut.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Symfony\Component\CssSelector\Parser;
|
|||
/**
|
||||
* CSS selector token.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -17,7 +17,7 @@ use Symfony\Component\CssSelector\Exception\SyntaxErrorException;
|
|||
/**
|
||||
* CSS selector token stream.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -19,7 +19,7 @@ use Symfony\Component\CssSelector\Parser\TokenStream;
|
|||
/**
|
||||
* CSS selector tokenizer.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Symfony\Component\CssSelector\Parser\Tokenizer;
|
|||
/**
|
||||
* CSS selector tokenizer escaping applier.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Symfony\Component\CssSelector\Parser\Tokenizer;
|
|||
/**
|
||||
* CSS selector tokenizer patterns builder.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -36,10 +36,9 @@ names are lower-cased, the following extra pseudo-classes are supported:
|
|||
Resources
|
||||
---------
|
||||
|
||||
This component is a port of the Python lxml library, which is copyright Infrae
|
||||
and distributed under the BSD license.
|
||||
|
||||
Current code is a port of https://github.com/SimonSapin/cssselect/releases/tag/v0.7.1
|
||||
This component is a port of the Python cssselect library
|
||||
[v0.7.1](https://github.com/SimonSapin/cssselect/releases/tag/v0.7.1),
|
||||
which is distributed under the BSD license.
|
||||
|
||||
You can run the unit tests with the following command:
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Symfony\Component\CssSelector\XPath\Extension;
|
|||
/**
|
||||
* XPath expression translator abstract extension.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -17,7 +17,7 @@ use Symfony\Component\CssSelector\XPath\XPathExpr;
|
|||
/**
|
||||
* XPath expression translator attribute extension.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -16,7 +16,7 @@ use Symfony\Component\CssSelector\XPath\XPathExpr;
|
|||
/**
|
||||
* XPath expression translator combination extension.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Symfony\Component\CssSelector\XPath\Extension;
|
|||
/**
|
||||
* XPath expression translator extension interface.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -21,7 +21,7 @@ use Symfony\Component\CssSelector\XPath\XPathExpr;
|
|||
/**
|
||||
* XPath expression translator function extension.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -19,7 +19,7 @@ use Symfony\Component\CssSelector\XPath\XPathExpr;
|
|||
/**
|
||||
* XPath expression translator HTML extension.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -18,7 +18,7 @@ use Symfony\Component\CssSelector\XPath\XPathExpr;
|
|||
/**
|
||||
* XPath expression translator node extension.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -17,7 +17,7 @@ use Symfony\Component\CssSelector\XPath\XPathExpr;
|
|||
/**
|
||||
* XPath expression translator pseudo-class extension.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -21,7 +21,7 @@ use Symfony\Component\CssSelector\Parser\ParserInterface;
|
|||
/**
|
||||
* XPath expression translator interface.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -16,7 +16,7 @@ use Symfony\Component\CssSelector\Node\SelectorNode;
|
|||
/**
|
||||
* XPath expression translator interface.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Symfony\Component\CssSelector\XPath;
|
|||
/**
|
||||
* XPath expression translator interface.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -15,6 +15,7 @@ use Symfony\Component\Form\Extension\Csrf\CsrfProvider\DefaultCsrfProvider;
|
|||
|
||||
/**
|
||||
* @runTestsInSeparateProcesses
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
class DefaultCsrfProviderTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
@ -24,6 +25,7 @@ class DefaultCsrfProviderTest extends \PHPUnit_Framework_TestCase
|
|||
{
|
||||
ini_set('session.save_handler', 'files');
|
||||
ini_set('session.save_path', sys_get_temp_dir());
|
||||
ini_set('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
}
|
||||
|
||||
protected function setUp()
|
||||
|
|
|
@ -39,7 +39,7 @@ class IpUtils
|
|||
$ips = array($ips);
|
||||
}
|
||||
|
||||
$method = false !== strpos($requestIp, ':') ? 'checkIp6' : 'checkIp4';
|
||||
$method = substr_count($requestIp, ':') > 1 ? 'checkIp6' : 'checkIp4';
|
||||
|
||||
foreach ($ips as $ip) {
|
||||
if (self::$method($requestIp, $ip)) {
|
||||
|
|
|
@ -816,6 +816,11 @@ class Request
|
|||
|
||||
// Eliminate all IPs from the forwarded IP chain which are trusted proxies
|
||||
foreach ($clientIps as $key => $clientIp) {
|
||||
// Remove port on IPv4 address (unfortunately, it does happen)
|
||||
if (preg_match('{((?:\d+\.){3}\d+)\:\d+}', $clientIp, $match)) {
|
||||
$clientIps[$key] = $clientIp = $match[1];
|
||||
}
|
||||
|
||||
if (IpUtils::checkIp($clientIp, self::$trustedProxies)) {
|
||||
unset($clientIps[$key]);
|
||||
}
|
||||
|
|
|
@ -885,6 +885,9 @@ class RequestTest extends \PHPUnit_Framework_TestCase
|
|||
array(array('3620:0:1cfe:face:b00c::3'), '1620:0:1cfe:face:b00c::3', '3620:0:1cfe:face:b00c::3,2620:0:1cfe:face:b00c::3', array('1620:0:1cfe:face:b00c::3', '2620:0:1cfe:face:b00c::3')),
|
||||
// multiple forwarded for with remote IPv4 addr and some reverse proxies trusted but in the middle
|
||||
array(array('2620:0:1cfe:face:b00c::3', '4620:0:1cfe:face:b00c::3'), '1620:0:1cfe:face:b00c::3', '4620:0:1cfe:face:b00c::3,3620:0:1cfe:face:b00c::3,2620:0:1cfe:face:b00c::3', array('1620:0:1cfe:face:b00c::3', '3620:0:1cfe:face:b00c::3')),
|
||||
|
||||
// client IP with port
|
||||
array(array('88.88.88.88'), '127.0.0.1', '88.88.88.88:12345, 127.0.0.1', array('127.0.0.1')),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage;
|
|||
* @author Drak <drak@zikula.org>
|
||||
*
|
||||
* @runTestsInSeparateProcesses
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
class NativeFileSessionHandlerTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
|
|
@ -19,6 +19,7 @@ use Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeSessionHandle
|
|||
* @author Drak <drak@zikula.org>
|
||||
*
|
||||
* @runTestsInSeparateProcesses
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
class NativeSessionHandlerTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
|
|
@ -21,6 +21,7 @@ use Symfony\Component\HttpFoundation\Session\Session;
|
|||
* @author Drak <drak@zikula.org>
|
||||
*
|
||||
* @runTestsInSeparateProcesses
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
class NullSessionHandlerTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
|
|
@ -27,6 +27,7 @@ use Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy;
|
|||
* These tests require separate processes.
|
||||
*
|
||||
* @runTestsInSeparateProcesses
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
class NativeSessionStorageTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
|
|
@ -22,6 +22,7 @@ use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag;
|
|||
* These tests require separate processes.
|
||||
*
|
||||
* @runTestsInSeparateProcesses
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
class PhpBridgeSessionStorageTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
|
|
@ -96,6 +96,7 @@ class AbstractProxyTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
/**
|
||||
* @runInSeparateProcess
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
public function testIsActivePhp54()
|
||||
{
|
||||
|
@ -122,6 +123,7 @@ class AbstractProxyTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
/**
|
||||
* @runInSeparateProcess
|
||||
* @preserveGlobalState disabled
|
||||
* @expectedException \LogicException
|
||||
*/
|
||||
public function testSetActivePhp54()
|
||||
|
@ -135,6 +137,7 @@ class AbstractProxyTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
/**
|
||||
* @runInSeparateProcess
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
public function testName()
|
||||
{
|
||||
|
@ -159,6 +162,7 @@ class AbstractProxyTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
/**
|
||||
* @runInSeparateProcess
|
||||
* @preserveGlobalState disabled
|
||||
* @expectedException \LogicException
|
||||
*/
|
||||
public function testNameExceptionPhp54()
|
||||
|
@ -173,6 +177,7 @@ class AbstractProxyTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
/**
|
||||
* @runInSeparateProcess
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
public function testId()
|
||||
{
|
||||
|
@ -197,6 +202,7 @@ class AbstractProxyTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
/**
|
||||
* @runInSeparateProcess
|
||||
* @preserveGlobalState disabled
|
||||
* @expectedException \LogicException
|
||||
*/
|
||||
public function testIdExceptionPhp54()
|
||||
|
|
|
@ -19,6 +19,7 @@ use Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy;
|
|||
* @author Drak <drak@zikula.org>
|
||||
*
|
||||
* @runTestsInSeparateProcesses
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
class SessionHandlerProxyTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
|
|
@ -36,6 +36,7 @@ class IntlDateFormatterTest extends AbstractIntlDateFormatterTest
|
|||
* time zone, this test would use it too if not running in a separated process.
|
||||
*
|
||||
* @runInSeparateProcess
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
public function testFormatWithTimezoneFromEnvironmentVariable()
|
||||
{
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
],
|
||||
"require": {
|
||||
"php": ">=5.3.3",
|
||||
"symfony/intl": ">=2.3"
|
||||
"symfony/intl": "~2.3"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": { "Symfony\\Component\\Locale\\": "" }
|
||||
|
|
Reference in New Issue