Merge branch '3.3' into 3.4
* 3.3: [TwigBridge] Fix namespaced classes bumped Symfony version to 3.3.2 updated VERSION for 3.3.1 updated CHANGELOG for 3.3.1 [DependencyInjection] Fix named args support in ChildDefinition [Cache] Fallback to positional when keyed results are broken [HttpFoundation][FrameworkBundle] Revert "trusted proxies" BC break [Cache] MemcachedAdapter not working with TagAwareAdapter Remove closure-proxy leftovers [DependencyInjection] Use more clear message when unused environment variables detected [Form][Profiler] Fixes form collector triggering deprecations mitigate BC break with empty trusted_proxies [Profiler] Never wrap in code excerpts [Form][FrameworkBundle] Remove non-existing arg for data_collector.form explain that a role can be an instance of Role [Cache] fix Redis scheme detection mix attr options between type-guess options and user options
This commit is contained in:
commit
b0ede2c9c8
@ -7,6 +7,36 @@ in 3.3 minor versions.
|
|||||||
To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash
|
To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash
|
||||||
To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v3.3.0...v3.3.1
|
To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v3.3.0...v3.3.1
|
||||||
|
|
||||||
|
* 3.3.1 (2017-06-05)
|
||||||
|
|
||||||
|
* bug #23067 [HttpFoundation][FrameworkBundle] Revert "trusted proxies" BC break (nicolas-grekas)
|
||||||
|
* bug #23065 [Cache] Fallback to positional when keyed results are broken (nicolas-grekas)
|
||||||
|
* bug #22981 [DependencyInjection] Fix named args support in ChildDefinition (dunglas)
|
||||||
|
* bug #23050 [Form][Profiler] Fixes form collector triggering deprecations (ogizanagi)
|
||||||
|
* bug #22971 [Profiler] Fix code excerpt wrapping (ogizanagi)
|
||||||
|
* bug #23049 [FrameworkBundle] mitigate BC break with empty trusted_proxies (xabbuh)
|
||||||
|
* bug #23045 [Cache] fix Redis scheme detection (xabbuh)
|
||||||
|
* bug #23013 Parse the _controller format in sub-requests (weaverryan)
|
||||||
|
* bug #23015 [PhpUnitBridge] Fix detection of PHPUnit 5 (enumag)
|
||||||
|
* bug #23041 [Config] Always protected ClassExistenceResource against bad parents (nicolas-grekas)
|
||||||
|
* bug #22988 [PropertyInfo][DoctrineBridge] The bigint Doctrine's type must be converted to string (dunglas)
|
||||||
|
* bug #23014 Fix optional cache warmers are always instantiated whereas they should be lazy-loaded (romainneutron)
|
||||||
|
* feature #23022 [Di] Remove closure-proxy arguments (nicolas-grekas)
|
||||||
|
* bug #23024 [EventDispatcher] Fix ContainerAwareEventDispatcher::hasListeners(null) (nicolas-grekas)
|
||||||
|
* bug #23008 [EventDispatcher] Handle laziness internally instead of relying on ClosureProxyArgument (nicolas-grekas)
|
||||||
|
* bug #23018 [FrameworkBundle] Fix CacheCollectorPass priority (chalasr)
|
||||||
|
* bug #23009 [Routing] Allow GET requests to be redirected. Fixes #23004 (frankdejonge)
|
||||||
|
* bug #22996 [Form] Fix \IntlDateFormatter timezone parameter usage to bypass PHP bug #66323 (romainneutron)
|
||||||
|
* bug #22965 [Cache] Ignore missing annotations.php (ro0NL)
|
||||||
|
* bug #22993 [DI] Autowiring exception thrown when inlined service is removed (weaverryan)
|
||||||
|
* bug #22999 Better DI type deprecation message (weaverryan)
|
||||||
|
* bug #22985 [Config] Allow empty globs (nicolas-grekas)
|
||||||
|
* bug #22961 [HttpKernel] Support unknown format in LoggerDataCollector (iltar)
|
||||||
|
* bug #22991 [DI] Don't throw Autowire exception for removed service with private __construct (weaverryan)
|
||||||
|
* bug #22968 [Profiler] Fix text selection & click on file links on exception pages (ogizanagi)
|
||||||
|
* bug #22994 Harden the debugging of Twig filters and functions (stof)
|
||||||
|
* bug #22960 [Cache] Fix decoration of TagAware adapters in dev (chalasr)
|
||||||
|
|
||||||
* 3.3.0 (2017-05-29)
|
* 3.3.0 (2017-05-29)
|
||||||
|
|
||||||
* bug #22940 [Config] Fallback to regular import when glob fails (nicolas-grekas)
|
* bug #22940 [Config] Fallback to regular import when glob fails (nicolas-grekas)
|
||||||
|
@ -14,6 +14,7 @@ namespace Symfony\Bridge\Twig\NodeVisitor;
|
|||||||
use Symfony\Bridge\Twig\Node\TransNode;
|
use Symfony\Bridge\Twig\Node\TransNode;
|
||||||
use Symfony\Bridge\Twig\Node\TransDefaultDomainNode;
|
use Symfony\Bridge\Twig\Node\TransDefaultDomainNode;
|
||||||
use Twig\Environment;
|
use Twig\Environment;
|
||||||
|
use Twig\Node\BlockNode;
|
||||||
use Twig\Node\Expression\ArrayExpression;
|
use Twig\Node\Expression\ArrayExpression;
|
||||||
use Twig\Node\Expression\AssignNameExpression;
|
use Twig\Node\Expression\AssignNameExpression;
|
||||||
use Twig\Node\Expression\ConstantExpression;
|
use Twig\Node\Expression\ConstantExpression;
|
||||||
@ -21,6 +22,7 @@ use Twig\Node\Expression\FilterExpression;
|
|||||||
use Twig\Node\Expression\NameExpression;
|
use Twig\Node\Expression\NameExpression;
|
||||||
use Twig\Node\ModuleNode;
|
use Twig\Node\ModuleNode;
|
||||||
use Twig\Node\Node;
|
use Twig\Node\Node;
|
||||||
|
use Twig\Node\SetNode;
|
||||||
use Twig\NodeVisitor\AbstractNodeVisitor;
|
use Twig\NodeVisitor\AbstractNodeVisitor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -48,7 +50,7 @@ class TranslationDefaultDomainNodeVisitor extends AbstractNodeVisitor
|
|||||||
*/
|
*/
|
||||||
protected function doEnterNode(Node $node, Environment $env)
|
protected function doEnterNode(Node $node, Environment $env)
|
||||||
{
|
{
|
||||||
if ($node instanceof Node_Block || $node instanceof ModuleNode) {
|
if ($node instanceof BlockNode || $node instanceof ModuleNode) {
|
||||||
$this->scope = $this->scope->enter();
|
$this->scope = $this->scope->enter();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,7 +64,7 @@ class TranslationDefaultDomainNodeVisitor extends AbstractNodeVisitor
|
|||||||
$name = new AssignNameExpression($var, $node->getTemplateLine());
|
$name = new AssignNameExpression($var, $node->getTemplateLine());
|
||||||
$this->scope->set('domain', new NameExpression($var, $node->getTemplateLine()));
|
$this->scope->set('domain', new NameExpression($var, $node->getTemplateLine()));
|
||||||
|
|
||||||
return new Node_Set(false, new Node(array($name)), new Node(array($node->getNode('expr'))), $node->getTemplateLine());
|
return new SetNode(false, new Node(array($name)), new Node(array($node->getNode('expr'))), $node->getTemplateLine());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,7 +106,7 @@ class TranslationDefaultDomainNodeVisitor extends AbstractNodeVisitor
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($node instanceof Node_Block || $node instanceof ModuleNode) {
|
if ($node instanceof BlockNode || $node instanceof ModuleNode) {
|
||||||
$this->scope = $this->scope->leave();
|
$this->scope = $this->scope->leave();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ CHANGELOG
|
|||||||
* Not defining the `type` option of the `framework.workflows.*` configuration entries is deprecated.
|
* Not defining the `type` option of the `framework.workflows.*` configuration entries is deprecated.
|
||||||
The default value will be `state_machine` in Symfony 4.0.
|
The default value will be `state_machine` in Symfony 4.0.
|
||||||
* Deprecated the `CompilerDebugDumpPass` class
|
* Deprecated the `CompilerDebugDumpPass` class
|
||||||
* [BC BREAK] Removed the "framework.trusted_proxies" configuration option and the corresponding "kernel.trusted_proxies" parameter
|
* Deprecated the "framework.trusted_proxies" configuration option and the corresponding "kernel.trusted_proxies" parameter
|
||||||
* Added a new new version strategy option called json_manifest_path
|
* Added a new new version strategy option called json_manifest_path
|
||||||
that allows you to use the `JsonManifestVersionStrategy`.
|
that allows you to use the `JsonManifestVersionStrategy`.
|
||||||
* Added `Symfony\Bundle\FrameworkBundle\Controller\AbstractController`. It provides
|
* Added `Symfony\Bundle\FrameworkBundle\Controller\AbstractController`. It provides
|
||||||
|
@ -307,11 +307,4 @@ abstract class Descriptor implements DescriptorInterface
|
|||||||
|
|
||||||
return $serviceIds;
|
return $serviceIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function formatClosure(\Closure $closure)
|
|
||||||
{
|
|
||||||
$r = new \ReflectionFunction($closure);
|
|
||||||
|
|
||||||
return 'closure';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -373,7 +373,7 @@ class JsonDescriptor extends Descriptor
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($callable instanceof \Closure) {
|
if ($callable instanceof \Closure) {
|
||||||
$data['type'] = $this->formatClosure($callable);
|
$data['type'] = 'closure';
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
@ -352,8 +352,7 @@ class MarkdownDescriptor extends Descriptor
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($callable instanceof \Closure) {
|
if ($callable instanceof \Closure) {
|
||||||
$formatted = $this->formatClosure($callable);
|
$string .= "\n- Type: `closure`";
|
||||||
$string .= "\n- Type: `$formatted`";
|
|
||||||
|
|
||||||
return $this->write($string."\n");
|
return $this->write($string."\n");
|
||||||
}
|
}
|
||||||
|
@ -475,15 +475,9 @@ class TextDescriptor extends Descriptor
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($callable instanceof \Closure) {
|
if ($callable instanceof \Closure) {
|
||||||
$formatted = $this->formatClosure($callable);
|
|
||||||
|
|
||||||
if ('closure' === $formatted) {
|
|
||||||
return '\Closure()';
|
return '\Closure()';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $formatted.'()';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (method_exists($callable, '__invoke')) {
|
if (method_exists($callable, '__invoke')) {
|
||||||
return sprintf('%s::__invoke()', get_class($callable));
|
return sprintf('%s::__invoke()', get_class($callable));
|
||||||
}
|
}
|
||||||
|
@ -593,7 +593,7 @@ class XmlDescriptor extends Descriptor
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($callable instanceof \Closure) {
|
if ($callable instanceof \Closure) {
|
||||||
$callableXML->setAttribute('type', $this->formatClosure($callable));
|
$callableXML->setAttribute('type', 'closure');
|
||||||
|
|
||||||
return $dom;
|
return $dom;
|
||||||
}
|
}
|
||||||
|
@ -65,10 +65,38 @@ class Configuration implements ConfigurationInterface
|
|||||||
->info("Set true to enable support for the '_method' request parameter to determine the intended HTTP method on POST requests. Note: When using the HttpCache, you need to call the method in your front controller instead")
|
->info("Set true to enable support for the '_method' request parameter to determine the intended HTTP method on POST requests. Note: When using the HttpCache, you need to call the method in your front controller instead")
|
||||||
->defaultTrue()
|
->defaultTrue()
|
||||||
->end()
|
->end()
|
||||||
->arrayNode('trusted_proxies') // @deprecated in version 3.3, to be removed in 4.0
|
->arrayNode('trusted_proxies')
|
||||||
->beforeNormalization()
|
->beforeNormalization()
|
||||||
->always()
|
->ifTrue(function ($v) {
|
||||||
->thenInvalid('The "framework.trusted_proxies" configuration key has been removed in Symfony 3.3. Use the Request::setTrustedProxies() method in your front controller instead.')
|
@trigger_error('The "framework.trusted_proxies" configuration key has been deprecated in Symfony 3.3. Use the Request::setTrustedProxies() method in your front controller instead.', E_USER_DEPRECATED);
|
||||||
|
|
||||||
|
return !is_array($v) && null !== $v;
|
||||||
|
})
|
||||||
|
->then(function ($v) { return is_bool($v) ? array() : preg_split('/\s*,\s*/', $v); })
|
||||||
|
->end()
|
||||||
|
->prototype('scalar')
|
||||||
|
->validate()
|
||||||
|
->ifTrue(function ($v) {
|
||||||
|
if (empty($v)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (false !== strpos($v, '/')) {
|
||||||
|
if ('0.0.0.0/0' === $v) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
list($v, $mask) = explode('/', $v, 2);
|
||||||
|
|
||||||
|
if (strcmp($mask, (int) $mask) || $mask < 1 || $mask > (false !== strpos($v, ':') ? 128 : 32)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return !filter_var($v, FILTER_VALIDATE_IP);
|
||||||
|
})
|
||||||
|
->thenInvalid('Invalid proxy IP "%s"')
|
||||||
|
->end()
|
||||||
->end()
|
->end()
|
||||||
->end()
|
->end()
|
||||||
->scalarNode('ide')->defaultNull()->end()
|
->scalarNode('ide')->defaultNull()->end()
|
||||||
|
@ -155,6 +155,9 @@ class FrameworkExtension extends Extension
|
|||||||
|
|
||||||
$container->setParameter('kernel.http_method_override', $config['http_method_override']);
|
$container->setParameter('kernel.http_method_override', $config['http_method_override']);
|
||||||
$container->setParameter('kernel.trusted_hosts', $config['trusted_hosts']);
|
$container->setParameter('kernel.trusted_hosts', $config['trusted_hosts']);
|
||||||
|
if ($config['trusted_proxies']) {
|
||||||
|
$container->setParameter('kernel.trusted_proxies', $config['trusted_proxies']);
|
||||||
|
}
|
||||||
$container->setParameter('kernel.default_locale', $config['default_locale']);
|
$container->setParameter('kernel.default_locale', $config['default_locale']);
|
||||||
|
|
||||||
if (!$container->hasParameter('debug.file_link_format')) {
|
if (!$container->hasParameter('debug.file_link_format')) {
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
<service id="data_collector.form" class="Symfony\Component\Form\Extension\DataCollector\FormDataCollector" public="true">
|
<service id="data_collector.form" class="Symfony\Component\Form\Extension\DataCollector\FormDataCollector" public="true">
|
||||||
<tag name="data_collector" template="@WebProfiler/Collector/form.html.twig" id="form" priority="310" />
|
<tag name="data_collector" template="@WebProfiler/Collector/form.html.twig" id="form" priority="310" />
|
||||||
<argument type="service" id="data_collector.form.extractor" />
|
<argument type="service" id="data_collector.form.extractor" />
|
||||||
<argument>false</argument>
|
|
||||||
</service>
|
</service>
|
||||||
</services>
|
</services>
|
||||||
</container>
|
</container>
|
||||||
|
@ -43,6 +43,103 @@ class ConfigurationTest extends TestCase
|
|||||||
$this->assertEquals(array('FrameworkBundle:Form'), $config['templating']['form']['resources']);
|
$this->assertEquals(array('FrameworkBundle:Form'), $config['templating']['form']['resources']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @group legacy
|
||||||
|
* @expectedDeprecation The "framework.trusted_proxies" configuration key has been deprecated in Symfony 3.3. Use the Request::setTrustedProxies() method in your front controller instead.
|
||||||
|
*/
|
||||||
|
public function testTrustedProxiesSetToNullIsDeprecated()
|
||||||
|
{
|
||||||
|
$processor = new Processor();
|
||||||
|
$configuration = new Configuration(true);
|
||||||
|
$processor->processConfiguration($configuration, array(array('trusted_proxies' => null)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @group legacy
|
||||||
|
* @expectedDeprecation The "framework.trusted_proxies" configuration key has been deprecated in Symfony 3.3. Use the Request::setTrustedProxies() method in your front controller instead.
|
||||||
|
*/
|
||||||
|
public function testTrustedProxiesSetToEmptyArrayIsDeprecated()
|
||||||
|
{
|
||||||
|
$processor = new Processor();
|
||||||
|
$configuration = new Configuration(true);
|
||||||
|
$processor->processConfiguration($configuration, array(array('trusted_proxies' => array())));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @group legacy
|
||||||
|
* @expectedDeprecation The "framework.trusted_proxies" configuration key has been deprecated in Symfony 3.3. Use the Request::setTrustedProxies() method in your front controller instead.
|
||||||
|
*/
|
||||||
|
public function testTrustedProxiesSetToNonEmptyArrayIsInvalid()
|
||||||
|
{
|
||||||
|
$processor = new Processor();
|
||||||
|
$configuration = new Configuration(true);
|
||||||
|
$processor->processConfiguration($configuration, array(array('trusted_proxies' => array('127.0.0.1'))));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @group legacy
|
||||||
|
* @dataProvider getTestValidTrustedProxiesData
|
||||||
|
*/
|
||||||
|
public function testValidTrustedProxies($trustedProxies, $processedProxies)
|
||||||
|
{
|
||||||
|
$processor = new Processor();
|
||||||
|
$configuration = new Configuration(true);
|
||||||
|
$config = $processor->processConfiguration($configuration, array(array(
|
||||||
|
'secret' => 's3cr3t',
|
||||||
|
'trusted_proxies' => $trustedProxies,
|
||||||
|
)));
|
||||||
|
|
||||||
|
$this->assertEquals($processedProxies, $config['trusted_proxies']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTestValidTrustedProxiesData()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
array(array('127.0.0.1'), array('127.0.0.1')),
|
||||||
|
array(array('::1'), array('::1')),
|
||||||
|
array(array('127.0.0.1', '::1'), array('127.0.0.1', '::1')),
|
||||||
|
array(null, array()),
|
||||||
|
array(false, array()),
|
||||||
|
array(array(), array()),
|
||||||
|
array(array('10.0.0.0/8'), array('10.0.0.0/8')),
|
||||||
|
array(array('::ffff:0:0/96'), array('::ffff:0:0/96')),
|
||||||
|
array(array('0.0.0.0/0'), array('0.0.0.0/0')),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @group legacy
|
||||||
|
* @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
|
||||||
|
*/
|
||||||
|
public function testInvalidTypeTrustedProxies()
|
||||||
|
{
|
||||||
|
$processor = new Processor();
|
||||||
|
$configuration = new Configuration(true);
|
||||||
|
$processor->processConfiguration($configuration, array(
|
||||||
|
array(
|
||||||
|
'secret' => 's3cr3t',
|
||||||
|
'trusted_proxies' => 'Not an IP address',
|
||||||
|
),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @group legacy
|
||||||
|
* @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
|
||||||
|
*/
|
||||||
|
public function testInvalidValueTrustedProxies()
|
||||||
|
{
|
||||||
|
$processor = new Processor();
|
||||||
|
$configuration = new Configuration(true);
|
||||||
|
|
||||||
|
$processor->processConfiguration($configuration, array(
|
||||||
|
array(
|
||||||
|
'secret' => 's3cr3t',
|
||||||
|
'trusted_proxies' => array('Not an IP address'),
|
||||||
|
),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
public function testAssetsCanBeEnabled()
|
public function testAssetsCanBeEnabled()
|
||||||
{
|
{
|
||||||
$processor = new Processor();
|
$processor = new Processor();
|
||||||
@ -124,6 +221,7 @@ class ConfigurationTest extends TestCase
|
|||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
'http_method_override' => true,
|
'http_method_override' => true,
|
||||||
|
'trusted_proxies' => array(),
|
||||||
'ide' => null,
|
'ide' => null,
|
||||||
'default_locale' => 'en',
|
'default_locale' => 'en',
|
||||||
'csrf_protection' => array(
|
'csrf_protection' => array(
|
||||||
|
@ -95,7 +95,7 @@ header .container { display: flex; justify-content: space-between; }
|
|||||||
.trace-head .icon svg { height: 24px; width: 24px; }
|
.trace-head .icon svg { height: 24px; width: 24px; }
|
||||||
|
|
||||||
.trace-message { font-size: 14px; font-weight: normal; margin: .5em 0 0; }
|
.trace-message { font-size: 14px; font-weight: normal; margin: .5em 0 0; }
|
||||||
|
.trace-details { table-layout: fixed; }
|
||||||
.trace-line { position: relative; padding-left: 36px; }
|
.trace-line { position: relative; padding-left: 36px; }
|
||||||
.trace-line.sf-toggle:hover { background: #F5F5F5; }
|
.trace-line.sf-toggle:hover { background: #F5F5F5; }
|
||||||
.trace-line a { color: #222; }
|
.trace-line a { color: #222; }
|
||||||
@ -108,12 +108,12 @@ header .container { display: flex; justify-content: space-between; }
|
|||||||
.trace-method { color: #B0413E; color: #222; font-weight: bold; color: #B0413E; }
|
.trace-method { color: #B0413E; color: #222; font-weight: bold; color: #B0413E; }
|
||||||
.trace-arguments { color: #222; color: #999; font-weight: normal; color: #795da3; color: #777; padding-left: 2px; }
|
.trace-arguments { color: #222; color: #999; font-weight: normal; color: #795da3; color: #777; padding-left: 2px; }
|
||||||
|
|
||||||
.trace-code { background: #FFF; font-size: 12px; margin: 10px 0 2px; padding: 10px; }
|
.trace-code { background: #FFF; font-size: 12px; margin: 10px 0 2px; padding: 10px; overflow-x: auto; }
|
||||||
.trace-code ol { margin: 0; }
|
.trace-code ol { margin: 0; float: left; }
|
||||||
.trace-code li { color: #969896; margin: 0; padding-left: 10px; }
|
.trace-code li { color: #969896; margin: 0; padding-left: 10px; float: left; width: 100%; }
|
||||||
.trace-code li + li { margin-top: 10px; }
|
.trace-code li + li { margin-top: 5px; }
|
||||||
.trace-code li.selected { background: #F8EEC7; padding: 3px 0 3px 10px; }
|
.trace-code li.selected { background: #F8EEC7; padding: 3px 0 3px 10px; margin-top: 2px; }
|
||||||
.trace-code li code { color: #222; }
|
.trace-code li code { color: #222; white-space: nowrap; }
|
||||||
|
|
||||||
.trace-as-text .stacktrace { line-height: 1.8; margin: 0 0 15px; white-space: pre-wrap; }
|
.trace-as-text .stacktrace { line-height: 1.8; margin: 0 0 15px; white-space: pre-wrap; }
|
||||||
|
|
||||||
|
@ -525,7 +525,7 @@
|
|||||||
<th class="font-normal" scope="row">Model Format</th>
|
<th class="font-normal" scope="row">Model Format</th>
|
||||||
<td>
|
<td>
|
||||||
{% if data.default_data.model is defined %}
|
{% if data.default_data.model is defined %}
|
||||||
{{ profiler_dump(data.default_data.model) }}
|
{{ profiler_dump(data.default_data.seek('model')) }}
|
||||||
{% else %}
|
{% else %}
|
||||||
<em class="font-normal text-muted">same as normalized format</em>
|
<em class="font-normal text-muted">same as normalized format</em>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@ -533,13 +533,13 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="font-normal" scope="row">Normalized Format</th>
|
<th class="font-normal" scope="row">Normalized Format</th>
|
||||||
<td>{{ profiler_dump(data.default_data.norm) }}</td>
|
<td>{{ profiler_dump(data.default_data.seek('norm')) }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="font-normal" scope="row">View Format</th>
|
<th class="font-normal" scope="row">View Format</th>
|
||||||
<td>
|
<td>
|
||||||
{% if data.default_data.view is defined %}
|
{% if data.default_data.view is defined %}
|
||||||
{{ profiler_dump(data.default_data.view) }}
|
{{ profiler_dump(data.default_data.seek('view')) }}
|
||||||
{% else %}
|
{% else %}
|
||||||
<em class="font-normal text-muted">same as normalized format</em>
|
<em class="font-normal text-muted">same as normalized format</em>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@ -571,7 +571,7 @@
|
|||||||
<th class="font-normal" scope="row">View Format</th>
|
<th class="font-normal" scope="row">View Format</th>
|
||||||
<td>
|
<td>
|
||||||
{% if data.submitted_data.view is defined %}
|
{% if data.submitted_data.view is defined %}
|
||||||
{{ profiler_dump(data.submitted_data.view) }}
|
{{ profiler_dump(data.submitted_data.seek('view')) }}
|
||||||
{% else %}
|
{% else %}
|
||||||
<em class="font-normal text-muted">same as normalized format</em>
|
<em class="font-normal text-muted">same as normalized format</em>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@ -579,13 +579,13 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="font-normal" scope="row">Normalized Format</th>
|
<th class="font-normal" scope="row">Normalized Format</th>
|
||||||
<td>{{ profiler_dump(data.submitted_data.norm) }}</td>
|
<td>{{ profiler_dump(data.submitted_data.seek('norm')) }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="font-normal" scope="row">Model Format</th>
|
<th class="font-normal" scope="row">Model Format</th>
|
||||||
<td>
|
<td>
|
||||||
{% if data.submitted_data.model is defined %}
|
{% if data.submitted_data.model is defined %}
|
||||||
{{ profiler_dump(data.submitted_data.model) }}
|
{{ profiler_dump(data.submitted_data.seek('model')) }}
|
||||||
{% else %}
|
{% else %}
|
||||||
<em class="font-normal text-muted">same as normalized format</em>
|
<em class="font-normal text-muted">same as normalized format</em>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@ -630,7 +630,7 @@
|
|||||||
{% if resolved_option_value == option_value %}
|
{% if resolved_option_value == option_value %}
|
||||||
<em class="font-normal text-muted">same as passed value</em>
|
<em class="font-normal text-muted">same as passed value</em>
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ profiler_dump(data.resolved_options[option]) }}
|
{{ profiler_dump(data.resolved_options.seek(option)) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -266,6 +266,9 @@ abstract class AbstractAdapter implements AdapterInterface, LoggerAwareInterface
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
foreach ($items as $id => $value) {
|
foreach ($items as $id => $value) {
|
||||||
|
if (!isset($keys[$id])) {
|
||||||
|
$id = key($keys);
|
||||||
|
}
|
||||||
$key = $keys[$id];
|
$key = $keys[$id];
|
||||||
unset($keys[$id]);
|
unset($keys[$id]);
|
||||||
yield $key => $f($key, $value, true);
|
yield $key => $f($key, $value, true);
|
||||||
|
@ -19,6 +19,18 @@ class MemcachedAdapter extends AbstractAdapter
|
|||||||
|
|
||||||
protected $maxIdLength = 250;
|
protected $maxIdLength = 250;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* Using a MemcachedAdapter with a TagAwareAdapter for storing tags is discouraged.
|
||||||
|
* Using a RedisAdapter is recommended instead. If you cannot do otherwise, be aware that:
|
||||||
|
* - the Memcached::OPT_BINARY_PROTOCOL must be enabled
|
||||||
|
* (that's the default when using MemcachedAdapter::createConnection());
|
||||||
|
* - tags eviction by Memcached's LRU algorithm will break by-tags invalidation;
|
||||||
|
* your Memcached memory should be large enough to never trigger LRU.
|
||||||
|
*
|
||||||
|
* Using a MemcachedAdapter as a pure items store is fine.
|
||||||
|
*/
|
||||||
public function __construct(\Memcached $client, $namespace = '', $defaultLifetime = 0)
|
public function __construct(\Memcached $client, $namespace = '', $defaultLifetime = 0)
|
||||||
{
|
{
|
||||||
$this->init($client, $namespace, $defaultLifetime);
|
$this->init($client, $namespace, $defaultLifetime);
|
||||||
|
@ -281,7 +281,7 @@ class TagAwareAdapter implements TagAwareAdapterInterface
|
|||||||
|
|
||||||
foreach ($items as $key => $item) {
|
foreach ($items as $key => $item) {
|
||||||
if (!$tagKeys) {
|
if (!$tagKeys) {
|
||||||
yield $key => $f($item, self::TAGS_PREFIX.$key, $itemTags);
|
yield $key => $f($item, static::TAGS_PREFIX.$key, $itemTags);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!isset($tagKeys[$key])) {
|
if (!isset($tagKeys[$key])) {
|
||||||
@ -306,7 +306,7 @@ class TagAwareAdapter implements TagAwareAdapterInterface
|
|||||||
$tagVersions = $tagKeys = null;
|
$tagVersions = $tagKeys = null;
|
||||||
|
|
||||||
foreach ($bufferedItems as $key => $item) {
|
foreach ($bufferedItems as $key => $item) {
|
||||||
yield $key => $f($item, self::TAGS_PREFIX.$key, $itemTags);
|
yield $key => $f($item, static::TAGS_PREFIX.$key, $itemTags);
|
||||||
}
|
}
|
||||||
$bufferedItems = null;
|
$bufferedItems = null;
|
||||||
}
|
}
|
||||||
|
@ -162,6 +162,9 @@ abstract class AbstractCache implements CacheInterface, LoggerAwareInterface
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
foreach ($values as $id => $value) {
|
foreach ($values as $id => $value) {
|
||||||
|
if (!isset($keys[$id])) {
|
||||||
|
$id = key($keys);
|
||||||
|
}
|
||||||
$key = $keys[$id];
|
$key = $keys[$id];
|
||||||
unset($keys[$id]);
|
unset($keys[$id]);
|
||||||
yield $key => $value;
|
yield $key => $value;
|
||||||
|
@ -15,6 +15,9 @@ use Symfony\Component\Cache\Adapter\FilesystemAdapter;
|
|||||||
use Symfony\Component\Cache\Adapter\TagAwareAdapter;
|
use Symfony\Component\Cache\Adapter\TagAwareAdapter;
|
||||||
use Symfony\Component\Cache\Adapter\TraceableTagAwareAdapter;
|
use Symfony\Component\Cache\Adapter\TraceableTagAwareAdapter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @group time-sensitive
|
||||||
|
*/
|
||||||
class TraceableTagAwareAdapterTest extends TraceableAdapterTest
|
class TraceableTagAwareAdapterTest extends TraceableAdapterTest
|
||||||
{
|
{
|
||||||
public function testInvalidateTags()
|
public function testInvalidateTags()
|
||||||
|
@ -15,6 +15,15 @@ use Cache\IntegrationTests\SimpleCacheTest;
|
|||||||
|
|
||||||
abstract class CacheTestCase extends SimpleCacheTest
|
abstract class CacheTestCase extends SimpleCacheTest
|
||||||
{
|
{
|
||||||
|
public static function validKeys()
|
||||||
|
{
|
||||||
|
if (defined('HHVM_VERSION')) {
|
||||||
|
return parent::validKeys();
|
||||||
|
}
|
||||||
|
|
||||||
|
return array_merge(parent::validKeys(), array(array("a\0b")));
|
||||||
|
}
|
||||||
|
|
||||||
public function testDefaultLifeTime()
|
public function testDefaultLifeTime()
|
||||||
{
|
{
|
||||||
if (isset($this->skippedTests[__FUNCTION__])) {
|
if (isset($this->skippedTests[__FUNCTION__])) {
|
||||||
|
@ -90,6 +90,11 @@ trait RedisTrait
|
|||||||
$params['dbindex'] = $m[1];
|
$params['dbindex'] = $m[1];
|
||||||
$params['path'] = substr($params['path'], 0, -strlen($m[0]));
|
$params['path'] = substr($params['path'], 0, -strlen($m[0]));
|
||||||
}
|
}
|
||||||
|
if (isset($params['host'])) {
|
||||||
|
$scheme = 'tcp';
|
||||||
|
} else {
|
||||||
|
$scheme = 'unix';
|
||||||
|
}
|
||||||
$params += array(
|
$params += array(
|
||||||
'host' => isset($params['host']) ? $params['host'] : $params['path'],
|
'host' => isset($params['host']) ? $params['host'] : $params['path'],
|
||||||
'port' => isset($params['host']) ? 6379 : null,
|
'port' => isset($params['host']) ? 6379 : null,
|
||||||
@ -120,7 +125,7 @@ trait RedisTrait
|
|||||||
throw new InvalidArgumentException(sprintf('Redis connection failed (%s): %s', $e, $dsn));
|
throw new InvalidArgumentException(sprintf('Redis connection failed (%s): %s', $e, $dsn));
|
||||||
}
|
}
|
||||||
} elseif (is_a($class, \Predis\Client::class, true)) {
|
} elseif (is_a($class, \Predis\Client::class, true)) {
|
||||||
$params['scheme'] = isset($params['host']) ? 'tcp' : 'unix';
|
$params['scheme'] = $scheme;
|
||||||
$params['database'] = $params['dbindex'] ?: null;
|
$params['database'] = $params['dbindex'] ?: null;
|
||||||
$params['password'] = $auth;
|
$params['password'] = $auth;
|
||||||
$redis = new $class((new Factory())->create($params));
|
$redis = new $class((new Factory())->create($params));
|
||||||
|
@ -62,7 +62,7 @@ class ChildDefinition extends Definition
|
|||||||
* If replaceArgument() has been used to replace an argument, this method
|
* If replaceArgument() has been used to replace an argument, this method
|
||||||
* will return the replacement value.
|
* will return the replacement value.
|
||||||
*
|
*
|
||||||
* @param int $index
|
* @param int|string $index
|
||||||
*
|
*
|
||||||
* @return mixed The argument value
|
* @return mixed The argument value
|
||||||
*
|
*
|
||||||
@ -74,13 +74,7 @@ class ChildDefinition extends Definition
|
|||||||
return $this->arguments['index_'.$index];
|
return $this->arguments['index_'.$index];
|
||||||
}
|
}
|
||||||
|
|
||||||
$lastIndex = count(array_filter(array_keys($this->arguments), 'is_int')) - 1;
|
return parent::getArgument($index);
|
||||||
|
|
||||||
if ($index < 0 || $index > $lastIndex) {
|
|
||||||
throw new OutOfBoundsException(sprintf('The index "%d" is not in the range [0, %d].', $index, $lastIndex));
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->arguments[$index];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -91,7 +85,7 @@ class ChildDefinition extends Definition
|
|||||||
* certain conventions when you want to overwrite the arguments of the
|
* certain conventions when you want to overwrite the arguments of the
|
||||||
* parent definition, otherwise your arguments will only be appended.
|
* parent definition, otherwise your arguments will only be appended.
|
||||||
*
|
*
|
||||||
* @param int $index
|
* @param int|string $index
|
||||||
* @param mixed $value
|
* @param mixed $value
|
||||||
*
|
*
|
||||||
* @return self the current instance
|
* @return self the current instance
|
||||||
@ -105,7 +99,7 @@ class ChildDefinition extends Definition
|
|||||||
} elseif (0 === strpos($index, '$')) {
|
} elseif (0 === strpos($index, '$')) {
|
||||||
$this->arguments[$index] = $value;
|
$this->arguments[$index] = $value;
|
||||||
} else {
|
} else {
|
||||||
throw new InvalidArgumentException('$index must be an integer.');
|
throw new InvalidArgumentException('The argument must be an existing index or the name of a constructor\'s parameter.');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
|
@ -175,7 +175,7 @@ class PhpDumper extends Dumper
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($unusedEnvs) {
|
if ($unusedEnvs) {
|
||||||
throw new EnvParameterException($unusedEnvs);
|
throw new EnvParameterException($unusedEnvs, null, 'Environment variables "%s" are never used. Please, check your container\'s configuration.');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $code;
|
return $code;
|
||||||
|
@ -18,8 +18,8 @@ namespace Symfony\Component\DependencyInjection\Exception;
|
|||||||
*/
|
*/
|
||||||
class EnvParameterException extends InvalidArgumentException
|
class EnvParameterException extends InvalidArgumentException
|
||||||
{
|
{
|
||||||
public function __construct(array $usedEnvs, \Exception $previous = null)
|
public function __construct(array $envs, \Exception $previous = null, $message = 'Incompatible use of dynamic environment variables "%s" found in parameters.')
|
||||||
{
|
{
|
||||||
parent::__construct(sprintf('Incompatible use of dynamic environment variables "%s" found in parameters.', implode('", "', $usedEnvs)), 0, $previous);
|
parent::__construct(sprintf($message, implode('", "', $envs)), 0, $previous);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -113,6 +113,10 @@ class ChildDefinitionTest extends TestCase
|
|||||||
$this->assertSame('baz', $def->getArgument(1));
|
$this->assertSame('baz', $def->getArgument(1));
|
||||||
|
|
||||||
$this->assertSame(array(0 => 'foo', 1 => 'bar', 'index_1' => 'baz'), $def->getArguments());
|
$this->assertSame(array(0 => 'foo', 1 => 'bar', 'index_1' => 'baz'), $def->getArguments());
|
||||||
|
|
||||||
|
$this->assertSame($def, $def->replaceArgument('$bar', 'val'));
|
||||||
|
$this->assertSame('val', $def->getArgument('$bar'));
|
||||||
|
$this->assertSame(array(0 => 'foo', 1 => 'bar', 'index_1' => 'baz', '$bar' => 'val'), $def->getArguments());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -336,7 +336,7 @@ class PhpDumperTest extends TestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException \Symfony\Component\DependencyInjection\Exception\EnvParameterException
|
* @expectedException \Symfony\Component\DependencyInjection\Exception\EnvParameterException
|
||||||
* @expectedExceptionMessage Incompatible use of dynamic environment variables "FOO" found in parameters.
|
* @expectedExceptionMessage Environment variables "FOO" are never used. Please, check your container's configuration.
|
||||||
*/
|
*/
|
||||||
public function testUnusedEnvParameter()
|
public function testUnusedEnvParameter()
|
||||||
{
|
{
|
||||||
|
@ -21,7 +21,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
|
|||||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||||
* @author Jordan Alliot <jordan.alliot@gmail.com>
|
* @author Jordan Alliot <jordan.alliot@gmail.com>
|
||||||
*
|
*
|
||||||
* @deprecated since 3.3, to be removed in 4.0. Use EventDispatcher with closure-proxy injection instead.
|
* @deprecated since 3.3, to be removed in 4.0. Use EventDispatcher with closure factories instead.
|
||||||
*/
|
*/
|
||||||
class ContainerAwareEventDispatcher extends EventDispatcher
|
class ContainerAwareEventDispatcher extends EventDispatcher
|
||||||
{
|
{
|
||||||
@ -60,7 +60,7 @@ class ContainerAwareEventDispatcher extends EventDispatcher
|
|||||||
$class = get_parent_class($class);
|
$class = get_parent_class($class);
|
||||||
}
|
}
|
||||||
if (__CLASS__ !== $class) {
|
if (__CLASS__ !== $class) {
|
||||||
@trigger_error(sprintf('The %s class is deprecated since version 3.3 and will be removed in 4.0. Use EventDispatcher with closure-proxy injection instead.', __CLASS__), E_USER_DEPRECATED);
|
@trigger_error(sprintf('The %s class is deprecated since version 3.3 and will be removed in 4.0. Use EventDispatcher with closure factories instead.', __CLASS__), E_USER_DEPRECATED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,7 +78,7 @@ class ContainerAwareEventDispatcher extends EventDispatcher
|
|||||||
*/
|
*/
|
||||||
public function addListenerService($eventName, $callback, $priority = 0)
|
public function addListenerService($eventName, $callback, $priority = 0)
|
||||||
{
|
{
|
||||||
@trigger_error(sprintf('The %s class is deprecated since version 3.3 and will be removed in 4.0. Use EventDispatcher with closure-proxy injection instead.', __CLASS__), E_USER_DEPRECATED);
|
@trigger_error(sprintf('The %s class is deprecated since version 3.3 and will be removed in 4.0. Use EventDispatcher with closure factories instead.', __CLASS__), E_USER_DEPRECATED);
|
||||||
|
|
||||||
if (!is_array($callback) || 2 !== count($callback)) {
|
if (!is_array($callback) || 2 !== count($callback)) {
|
||||||
throw new \InvalidArgumentException('Expected an array("service", "method") argument');
|
throw new \InvalidArgumentException('Expected an array("service", "method") argument');
|
||||||
|
@ -115,7 +115,13 @@ class FormFactory implements FormFactoryInterface
|
|||||||
|
|
||||||
// user options may override guessed options
|
// user options may override guessed options
|
||||||
if ($typeGuess) {
|
if ($typeGuess) {
|
||||||
$options = array_merge($typeGuess->getOptions(), $options);
|
$attrs = array();
|
||||||
|
$typeGuessOptions = $typeGuess->getOptions();
|
||||||
|
if (isset($typeGuessOptions['attr']) && isset($options['attr'])) {
|
||||||
|
$attrs = array('attr' => array_merge($typeGuessOptions['attr'], $options['attr']));
|
||||||
|
}
|
||||||
|
|
||||||
|
$options = array_merge($typeGuessOptions, $options, $attrs);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->createNamedBuilder($property, $type, $data, $options);
|
return $this->createNamedBuilder($property, $type, $data, $options);
|
||||||
|
@ -310,7 +310,7 @@ class FormFactoryTest extends TestCase
|
|||||||
->with('Application\Author', 'firstName')
|
->with('Application\Author', 'firstName')
|
||||||
->will($this->returnValue(new TypeGuess(
|
->will($this->returnValue(new TypeGuess(
|
||||||
'Symfony\Component\Form\Extension\Core\Type\TextType',
|
'Symfony\Component\Form\Extension\Core\Type\TextType',
|
||||||
array('attr' => array('maxlength' => 10)),
|
array('attr' => array('class' => 'foo', 'maxlength' => 10)),
|
||||||
Guess::MEDIUM_CONFIDENCE
|
Guess::MEDIUM_CONFIDENCE
|
||||||
)));
|
)));
|
||||||
|
|
||||||
@ -318,7 +318,7 @@ class FormFactoryTest extends TestCase
|
|||||||
|
|
||||||
$factory->expects($this->once())
|
$factory->expects($this->once())
|
||||||
->method('createNamedBuilder')
|
->method('createNamedBuilder')
|
||||||
->with('firstName', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, array('attr' => array('maxlength' => 11)))
|
->with('firstName', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, array('attr' => array('class' => 'foo', 'maxlength' => 11)))
|
||||||
->will($this->returnValue('builderInstance'));
|
->will($this->returnValue('builderInstance'));
|
||||||
|
|
||||||
$this->builder = $factory->createBuilderForProperty(
|
$this->builder = $factory->createBuilderForProperty(
|
||||||
|
@ -4,7 +4,7 @@ CHANGELOG
|
|||||||
3.3.0
|
3.3.0
|
||||||
-----
|
-----
|
||||||
|
|
||||||
* [BC BREAK] the `Request::setTrustedProxies()` method takes a new `$trustedHeaderSet` argument,
|
* the `Request::setTrustedProxies()` method takes a new `$trustedHeaderSet` argument,
|
||||||
see http://symfony.com/doc/current/components/http_foundation/trusting_proxies.html for more info,
|
see http://symfony.com/doc/current/components/http_foundation/trusting_proxies.html for more info,
|
||||||
* deprecated the `Request::setTrustedHeaderName()` and `Request::getTrustedHeaderName()` methods,
|
* deprecated the `Request::setTrustedHeaderName()` and `Request::getTrustedHeaderName()` methods,
|
||||||
* added `File\Stream`, to be passed to `BinaryFileResponse` when the size of the served file is unknown,
|
* added `File\Stream`, to be passed to `BinaryFileResponse` when the size of the served file is unknown,
|
||||||
|
@ -581,7 +581,7 @@ class Request
|
|||||||
* You should only list the reverse proxies that you manage directly.
|
* You should only list the reverse proxies that you manage directly.
|
||||||
*
|
*
|
||||||
* @param array $proxies A list of trusted proxies
|
* @param array $proxies A list of trusted proxies
|
||||||
* @param int $trustedHeaderSet A bit field of Request::HEADER_*, usually either Request::HEADER_FORWARDED or Request::HEADER_X_FORWARDED_ALL, to set which headers to trust from your proxies
|
* @param int $trustedHeaderSet A bit field of Request::HEADER_*, to set which headers to trust from your proxies
|
||||||
*
|
*
|
||||||
* @throws \InvalidArgumentException When $trustedHeaderSet is invalid
|
* @throws \InvalidArgumentException When $trustedHeaderSet is invalid
|
||||||
*/
|
*/
|
||||||
@ -590,10 +590,11 @@ class Request
|
|||||||
self::$trustedProxies = $proxies;
|
self::$trustedProxies = $proxies;
|
||||||
|
|
||||||
if (2 > func_num_args()) {
|
if (2 > func_num_args()) {
|
||||||
// @deprecated code path in 3.3, to be replaced by mandatory argument in 4.0.
|
@trigger_error(sprintf('The %s() method expects a bit field of Request::HEADER_* as second argument since version 3.3. Defining it will be required in 4.0. ', __METHOD__), E_USER_DEPRECATED);
|
||||||
throw new \InvalidArgumentException(sprintf('The %s() method expects a bit field of Request::HEADER_* as second argument. Defining it is required since version 3.3. See http://symfony.com/doc/current/components/http_foundation/trusting_proxies.html for more info.', __METHOD__));
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
$trustedHeaderSet = func_get_arg(1);
|
$trustedHeaderSet = (int) func_get_arg(1);
|
||||||
|
|
||||||
foreach (self::$trustedHeaderNames as $header => $name) {
|
foreach (self::$trustedHeaderNames as $header => $name) {
|
||||||
self::$trustedHeaders[$header] = $header & $trustedHeaderSet ? $name : null;
|
self::$trustedHeaders[$header] = $header & $trustedHeaderSet ? $name : null;
|
||||||
@ -665,11 +666,11 @@ class Request
|
|||||||
*
|
*
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
*
|
*
|
||||||
* @deprecated since version 3.3, to be removed in 4.0. Use "X-Forwarded-*" headers or the "Forwarded" header defined in RFC7239, and the $trustedHeaderSet argument of the Request::setTrustedProxies() method instead.
|
* @deprecated since version 3.3, to be removed in 4.0. Use the $trustedHeaderSet argument of the Request::setTrustedProxies() method instead.
|
||||||
*/
|
*/
|
||||||
public static function setTrustedHeaderName($key, $value)
|
public static function setTrustedHeaderName($key, $value)
|
||||||
{
|
{
|
||||||
@trigger_error(sprintf('The "%s()" method is deprecated since version 3.3 and will be removed in 4.0. Use "X-Forwarded-*" headers or the "Forwarded" header defined in RFC7239, and the $trustedHeaderSet argument of the Request::setTrustedProxies() method instead.', __METHOD__), E_USER_DEPRECATED);
|
@trigger_error(sprintf('The "%s()" method is deprecated since version 3.3 and will be removed in 4.0. Use the $trustedHeaderSet argument of the Request::setTrustedProxies() method instead.', __METHOD__), E_USER_DEPRECATED);
|
||||||
|
|
||||||
if (!array_key_exists($key, self::$trustedHeaders)) {
|
if (!array_key_exists($key, self::$trustedHeaders)) {
|
||||||
throw new \InvalidArgumentException(sprintf('Unable to set the trusted header name for key "%s".', $key));
|
throw new \InvalidArgumentException(sprintf('Unable to set the trusted header name for key "%s".', $key));
|
||||||
@ -679,6 +680,9 @@ class Request
|
|||||||
|
|
||||||
if (null !== $value) {
|
if (null !== $value) {
|
||||||
self::$trustedHeaderNames[$key] = $value;
|
self::$trustedHeaderNames[$key] = $value;
|
||||||
|
self::$trustedHeaderSet |= $key;
|
||||||
|
} else {
|
||||||
|
self::$trustedHeaderSet &= ~$key;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -886,8 +890,8 @@ class Request
|
|||||||
* adding the IP address where it received the request from.
|
* adding the IP address where it received the request from.
|
||||||
*
|
*
|
||||||
* If your reverse proxy uses a different header name than "X-Forwarded-For",
|
* If your reverse proxy uses a different header name than "X-Forwarded-For",
|
||||||
* ("Client-Ip" for instance), configure it via "setTrustedHeaderName()" with
|
* ("Client-Ip" for instance), configure it via the $trustedHeaderSet
|
||||||
* the "client-ip" key.
|
* argument of the Request::setTrustedProxies() method instead.
|
||||||
*
|
*
|
||||||
* @return string|null The client IP address
|
* @return string|null The client IP address
|
||||||
*
|
*
|
||||||
@ -993,7 +997,8 @@ class Request
|
|||||||
* The "X-Forwarded-Port" header must contain the client port.
|
* The "X-Forwarded-Port" header must contain the client port.
|
||||||
*
|
*
|
||||||
* If your reverse proxy uses a different header name than "X-Forwarded-Port",
|
* If your reverse proxy uses a different header name than "X-Forwarded-Port",
|
||||||
* configure it via "setTrustedHeaderName()" with the "client-port" key.
|
* configure it via via the $trustedHeaderSet argument of the
|
||||||
|
* Request::setTrustedProxies() method instead.
|
||||||
*
|
*
|
||||||
* @return int|string can be a string if fetched from the server bag
|
* @return int|string can be a string if fetched from the server bag
|
||||||
*/
|
*/
|
||||||
@ -1210,8 +1215,8 @@ class Request
|
|||||||
* The "X-Forwarded-Proto" header must contain the protocol: "https" or "http".
|
* The "X-Forwarded-Proto" header must contain the protocol: "https" or "http".
|
||||||
*
|
*
|
||||||
* If your reverse proxy uses a different header name than "X-Forwarded-Proto"
|
* If your reverse proxy uses a different header name than "X-Forwarded-Proto"
|
||||||
* ("SSL_HTTPS" for instance), configure it via "setTrustedHeaderName()" with
|
* ("SSL_HTTPS" for instance), configure it via the $trustedHeaderSet
|
||||||
* the "client-proto" key.
|
* argument of the Request::setTrustedProxies() method instead.
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
@ -1235,7 +1240,8 @@ class Request
|
|||||||
* The "X-Forwarded-Host" header must contain the client host name.
|
* The "X-Forwarded-Host" header must contain the client host name.
|
||||||
*
|
*
|
||||||
* If your reverse proxy uses a different header name than "X-Forwarded-Host",
|
* If your reverse proxy uses a different header name than "X-Forwarded-Host",
|
||||||
* configure it via "setTrustedHeaderName()" with the "client-host" key.
|
* configure it via the $trustedHeaderSet argument of the
|
||||||
|
* Request::setTrustedProxies() method instead.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*
|
*
|
||||||
|
@ -1729,7 +1729,7 @@ class RequestTest extends TestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @group legacy
|
* @group legacy
|
||||||
* @expectedDeprecation The "Symfony\Component\HttpFoundation\Request::setTrustedHeaderName()" method is deprecated since version 3.3 and will be removed in 4.0. Use "X-Forwarded-*" headers or the "Forwarded" header defined in RFC7239, and the $trustedHeaderSet argument of the Request::setTrustedProxies() method instead.
|
* @expectedDeprecation The "Symfony\Component\HttpFoundation\Request::setTrustedHeaderName()" method is deprecated since version 3.3 and will be removed in 4.0. Use the $trustedHeaderSet argument of the Request::setTrustedProxies() method instead.
|
||||||
*/
|
*/
|
||||||
public function testLegacyTrustedProxies()
|
public function testLegacyTrustedProxies()
|
||||||
{
|
{
|
||||||
|
@ -43,7 +43,7 @@ abstract class AbstractToken implements TokenInterface
|
|||||||
if (is_string($role)) {
|
if (is_string($role)) {
|
||||||
$role = new Role($role);
|
$role = new Role($role);
|
||||||
} elseif (!$role instanceof RoleInterface) {
|
} elseif (!$role instanceof RoleInterface) {
|
||||||
throw new \InvalidArgumentException(sprintf('$roles must be an array of strings, or RoleInterface instances, but got %s.', gettype($role)));
|
throw new \InvalidArgumentException(sprintf('$roles must be an array of strings, Role instances or RoleInterface instances, but got %s.', gettype($role)));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->roles[] = $role;
|
$this->roles[] = $role;
|
||||||
|
Reference in New Issue
Block a user