diff --git a/src/Symfony/Component/Cache/Adapter/FilesystemAdapterTrait.php b/src/Symfony/Component/Cache/Adapter/FilesystemAdapterTrait.php
index faf6e50f0f948..2f6e43e6379fa 100644
--- a/src/Symfony/Component/Cache/Adapter/FilesystemAdapterTrait.php
+++ b/src/Symfony/Component/Cache/Adapter/FilesystemAdapterTrait.php
@@ -15,6 +15,8 @@
/**
* @author Nicolas Grekas
+ *
+ * @internal
*/
trait FilesystemAdapterTrait
{
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/AdapterTestCase.php b/src/Symfony/Component/Cache/Tests/Adapter/AdapterTestCase.php
index 4bc80ee30022e..c3cbd3bef7e54 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/AdapterTestCase.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/AdapterTestCase.php
@@ -28,8 +28,6 @@ public function testDefaultLifeTime()
{
if (isset($this->skippedTests[__FUNCTION__])) {
$this->markTestSkipped($this->skippedTests[__FUNCTION__]);
-
- return;
}
$cache = $this->createCachePool(2);
@@ -51,8 +49,6 @@ public function testNotUnserializable()
{
if (isset($this->skippedTests[__FUNCTION__])) {
$this->markTestSkipped($this->skippedTests[__FUNCTION__]);
-
- return;
}
$cache = $this->createCachePool();
diff --git a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php
index ae81fe36fdef6..58a38048f7530 100644
--- a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php
+++ b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php
@@ -424,7 +424,7 @@ public function get($id, $invalidBehavior = ContainerInterface::EXCEPTION_ON_INV
}
if (!isset($this->definitions[$id]) && isset($this->aliasDefinitions[$id])) {
- return $this->get($this->aliasDefinitions[$id]);
+ return $this->get($this->aliasDefinitions[$id], $invalidBehavior);
}
try {
@@ -835,6 +835,10 @@ public function findDefinition($id)
*/
private function createService(Definition $definition, $id, $tryProxy = true)
{
+ if ($definition instanceof DefinitionDecorator) {
+ throw new RuntimeException(sprintf('Constructing service "%s" from a parent definition is not supported at build time.', $id));
+ }
+
if ($definition->isSynthetic()) {
throw new RuntimeException(sprintf('You have requested a synthetic service ("%s"). The DIC does not know how to construct this service.', $id));
}
@@ -897,15 +901,15 @@ private function createService(Definition $definition, $id, $tryProxy = true)
$this->shareService($definition, $service, $id);
}
- foreach ($definition->getMethodCalls() as $call) {
- $this->callMethod($service, $call);
- }
-
$properties = $this->resolveServices($parameterBag->unescapeValue($parameterBag->resolveValue($definition->getProperties())));
foreach ($properties as $name => $value) {
$service->$name = $value;
}
+ foreach ($definition->getMethodCalls() as $call) {
+ $this->callMethod($service, $call);
+ }
+
if ($callable = $definition->getConfigurator()) {
if (is_array($callable)) {
$callable[0] = $parameterBag->resolveValue($callable[0]);
diff --git a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php
index 58666ef9478cc..46878eb7af51c 100644
--- a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php
+++ b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php
@@ -347,8 +347,8 @@ private function addServiceInlinedDefinitions($id, $definition)
$code .= $this->addNewInstance($sDefinition, '$'.$name, ' = ', $id);
if (!$this->hasReference($id, $sDefinition->getMethodCalls(), true) && !$this->hasReference($id, $sDefinition->getProperties(), true)) {
- $code .= $this->addServiceMethodCalls(null, $sDefinition, $name);
$code .= $this->addServiceProperties(null, $sDefinition, $name);
+ $code .= $this->addServiceMethodCalls(null, $sDefinition, $name);
$code .= $this->addServiceConfigurator(null, $sDefinition, $name);
}
@@ -517,8 +517,8 @@ private function addServiceInlinedDefinitionsSetup($id, Definition $definition)
}
$name = (string) $this->definitionVariables->offsetGet($iDefinition);
- $code .= $this->addServiceMethodCalls(null, $iDefinition, $name);
$code .= $this->addServiceProperties(null, $iDefinition, $name);
+ $code .= $this->addServiceMethodCalls(null, $iDefinition, $name);
$code .= $this->addServiceConfigurator(null, $iDefinition, $name);
}
@@ -678,8 +678,8 @@ private function addService($id, Definition $definition)
$this->addServiceInlinedDefinitions($id, $definition).
$this->addServiceInstance($id, $definition).
$this->addServiceInlinedDefinitionsSetup($id, $definition).
- $this->addServiceMethodCalls($id, $definition).
$this->addServiceProperties($id, $definition).
+ $this->addServiceMethodCalls($id, $definition).
$this->addServiceConfigurator($id, $definition).
$this->addServiceReturn($id, $definition)
;
diff --git a/src/Symfony/Component/DependencyInjection/ParameterBag/EnvPlaceholderParameterBag.php b/src/Symfony/Component/DependencyInjection/ParameterBag/EnvPlaceholderParameterBag.php
index 46d2a739dc5e5..d20e53531aa3b 100644
--- a/src/Symfony/Component/DependencyInjection/ParameterBag/EnvPlaceholderParameterBag.php
+++ b/src/Symfony/Component/DependencyInjection/ParameterBag/EnvPlaceholderParameterBag.php
@@ -41,8 +41,8 @@ public function get($name)
if ($this->has($name)) {
$defaultValue = parent::get($name);
- if (!is_scalar($defaultValue)) {
- throw new RuntimeException(sprintf('The default value of an env() parameter must be scalar, but "%s" given to "%s".', gettype($defaultValue), $name));
+ if (null !== $defaultValue && !is_scalar($defaultValue)) {
+ throw new RuntimeException(sprintf('The default value of an env() parameter must be scalar or null, but "%s" given to "%s".', gettype($defaultValue), $name));
}
}
@@ -96,8 +96,8 @@ public function resolve()
}
if (is_numeric($default = $this->parameters[$name])) {
$this->parameters[$name] = (string) $default;
- } elseif (null !== $default && !is_string($default)) {
- throw new RuntimeException(sprintf('The default value of env parameter "%s" must be string or null, %s given.', $env, gettype($default)));
+ } elseif (null !== $default && !is_scalar($default)) {
+ throw new RuntimeException(sprintf('The default value of env parameter "%s" must be scalar or null, %s given.', $env, gettype($default)));
}
}
}
diff --git a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php
index a833b9baf1755..155da75fb7958 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php
@@ -20,6 +20,7 @@
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Definition;
+use Symfony\Component\DependencyInjection\DefinitionDecorator;
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
use Symfony\Component\DependencyInjection\Loader\ClosureLoader;
@@ -27,6 +28,7 @@
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
use Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag;
use Symfony\Component\Config\Resource\FileResource;
+use Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition;
use Symfony\Component\ExpressionLanguage\Expression;
class ContainerBuilderTest extends \PHPUnit_Framework_TestCase
@@ -265,6 +267,18 @@ public function testSetReplacesAlias()
$this->assertSame($foo, $builder->get('alias'), '->set() replaces an existing alias');
}
+ public function testAliasesKeepInvalidBehavior()
+ {
+ $builder = new ContainerBuilder();
+
+ $aliased = new Definition('stdClass');
+ $aliased->addMethodCall('setBar', array(new Reference('bar', ContainerInterface::IGNORE_ON_INVALID_REFERENCE)));
+ $builder->setDefinition('aliased', $aliased);
+ $builder->setAlias('alias', 'aliased');
+
+ $this->assertEquals(new \stdClass(), $builder->get('alias'));
+ }
+
public function testAddGetCompilerPass()
{
$builder = new ContainerBuilder();
@@ -412,6 +426,28 @@ public function testResolveServices()
$this->assertEquals($builder->get('foo'), $builder->resolveServices(new Expression('service("foo")')), '->resolveServices() resolves expressions');
}
+ /**
+ * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
+ * @expectedExceptionMessage Constructing service "foo" from a parent definition is not supported at build time.
+ */
+ public function testResolveServicesWithDecoratedDefinition()
+ {
+ $builder = new ContainerBuilder();
+ $builder->setDefinition('grandpa', new Definition('stdClass'));
+ $builder->setDefinition('parent', new DefinitionDecorator('grandpa'));
+ $builder->setDefinition('foo', new DefinitionDecorator('parent'));
+
+ $builder->get('foo');
+ }
+
+ public function testResolveServicesWithCustomDefinitionClass()
+ {
+ $builder = new ContainerBuilder();
+ $builder->setDefinition('foo', new CustomDefinition('stdClass'));
+
+ $this->assertInstanceOf('stdClass', $builder->get('foo'));
+ }
+
public function testMerge()
{
$container = new ContainerBuilder(new ParameterBag(array('bar' => 'foo')));
@@ -760,6 +796,20 @@ public function testLazyLoadedService()
$this->assertTrue($classInList);
}
+ public function testInitializePropertiesBeforeMethodCalls()
+ {
+ $container = new ContainerBuilder();
+ $container->register('foo', 'stdClass');
+ $container->register('bar', 'MethodCallClass')
+ ->setProperty('simple', 'bar')
+ ->setProperty('complex', new Reference('foo'))
+ ->addMethodCall('callMe');
+
+ $container->compile();
+
+ $this->assertTrue($container->get('bar')->callPassed(), '->compile() initializes properties before method calls');
+ }
+
public function testAutowiring()
{
$container = new ContainerBuilder();
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php b/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php
index f6d4cdd6ac7c7..b4197d4326db3 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php
@@ -321,4 +321,23 @@ public function testInlinedDefinitionReferencingServiceContainer()
$dumper = new PhpDumper($container);
$this->assertStringEqualsFile(self::$fixturesPath.'/php/services13.php', $dumper->dump(), '->dump() dumps inline definitions which reference service_container');
}
+
+ public function testInitializePropertiesBeforeMethodCalls()
+ {
+ require_once self::$fixturesPath.'/includes/classes.php';
+
+ $container = new ContainerBuilder();
+ $container->register('foo', 'stdClass');
+ $container->register('bar', 'MethodCallClass')
+ ->setProperty('simple', 'bar')
+ ->setProperty('complex', new Reference('foo'))
+ ->addMethodCall('callMe');
+ $container->compile();
+
+ $dumper = new PhpDumper($container);
+ eval('?>'.$dumper->dump(array('class' => 'Symfony_DI_PhpDumper_Test_Properties_Before_Method_Calls')));
+
+ $container = new \Symfony_DI_PhpDumper_Test_Properties_Before_Method_Calls();
+ $this->assertTrue($container->get('bar')->callPassed(), '->dump() initializes properties before method calls');
+ }
}
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/CustomDefinition.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/CustomDefinition.php
new file mode 100644
index 0000000000000..65eea2106ed70
--- /dev/null
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/CustomDefinition.php
@@ -0,0 +1,18 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\DependencyInjection\Tests\Fixtures;
+
+use Symfony\Component\DependencyInjection\Definition;
+
+class CustomDefinition extends Definition
+{
+}
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/classes.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/classes.php
index 70c3d275b8898..48b687c1f4e53 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/classes.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/classes.php
@@ -59,3 +59,20 @@ public function __construct(BarClass $bar)
$this->bar = $bar;
}
}
+
+class MethodCallClass
+{
+ public $simple;
+ public $complex;
+ private $callPassed = false;
+
+ public function callMe()
+ {
+ $this->callPassed = is_scalar($this->simple) && is_object($this->complex);
+ }
+
+ public function callPassed()
+ {
+ return $this->callPassed;
+ }
+}
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php
index 7c6760d2d2b3c..306375d1b5541 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php
@@ -228,11 +228,11 @@ protected function getFooService()
$this->services['foo'] = $instance = \Bar\FooClass::getInstance('foo', $a, array($this->getParameter('foo') => 'foo is '.$this->getParameter('foo').'', 'foobar' => $this->getParameter('foo')), true, $this);
- $instance->setBar($this->get('bar'));
- $instance->initialize();
$instance->foo = 'bar';
$instance->moo = $a;
$instance->qux = array($this->getParameter('foo') => 'foo is '.$this->getParameter('foo').'', 'foobar' => $this->getParameter('foo'));
+ $instance->setBar($this->get('bar'));
+ $instance->initialize();
sc_configure($instance);
return $instance;
@@ -425,8 +425,8 @@ protected function getInlinedService()
{
$this->services['inlined'] = $instance = new \Bar();
- $instance->setBaz($this->get('baz'));
$instance->pub = 'pub';
+ $instance->setBaz($this->get('baz'));
return $instance;
}
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php
index 2ccadfe16d384..f8b263c2a01f3 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php
@@ -224,11 +224,11 @@ protected function getFooService()
$this->services['foo'] = $instance = \Bar\FooClass::getInstance('foo', $a, array('bar' => 'foo is bar', 'foobar' => 'bar'), true, $this);
- $instance->setBar($this->get('bar'));
- $instance->initialize();
$instance->foo = 'bar';
$instance->moo = $a;
$instance->qux = array('bar' => 'foo is bar', 'foobar' => 'bar');
+ $instance->setBar($this->get('bar'));
+ $instance->initialize();
sc_configure($instance);
return $instance;
@@ -275,8 +275,8 @@ protected function getFooWithInlineService()
$this->services['foo_with_inline'] = $instance = new \Foo();
- $a->setBaz($this->get('baz'));
$a->pub = 'pub';
+ $a->setBaz($this->get('baz'));
$instance->setBar($a);
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php
index 7d5f95df14889..5a166d963dc67 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php
@@ -131,8 +131,8 @@ public function testLoadImports()
{
$container = new ContainerBuilder();
$resolver = new LoaderResolver(array(
- new IniFileLoader($container, new FileLocator(self::$fixturesPath.'/xml')),
- new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml')),
+ new IniFileLoader($container, new FileLocator(self::$fixturesPath.'/ini')),
+ new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/yml')),
$loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml')),
));
$loader->setResolver($resolver);
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php
index dccce3ac2e17a..fabaa4859c578 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php
@@ -104,8 +104,8 @@ public function testLoadImports()
{
$container = new ContainerBuilder();
$resolver = new LoaderResolver(array(
- new IniFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml')),
- new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml')),
+ new IniFileLoader($container, new FileLocator(self::$fixturesPath.'/ini')),
+ new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml')),
new PhpFileLoader($container, new FileLocator(self::$fixturesPath.'/php')),
$loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml')),
));
diff --git a/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/EnvPlaceholderParameterBagTest.php b/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/EnvPlaceholderParameterBagTest.php
index 1a24b3d6e2663..c898038e39402 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/EnvPlaceholderParameterBagTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/EnvPlaceholderParameterBagTest.php
@@ -130,7 +130,7 @@ public function testResolveEnvAllowsNull()
/**
* @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
- * @expectedExceptionMessage The default value of env parameter "ARRAY_VAR" must be string or null, array given.
+ * @expectedExceptionMessage The default value of env parameter "ARRAY_VAR" must be scalar or null, array given.
*/
public function testResolveThrowsOnBadDefaultValue()
{
@@ -139,4 +139,26 @@ public function testResolveThrowsOnBadDefaultValue()
$bag->set('env(Array_Var)', array());
$bag->resolve();
}
+
+ public function testGetEnvAllowsNull()
+ {
+ $bag = new EnvPlaceholderParameterBag();
+ $bag->set('env(NULL_VAR)', null);
+ $bag->get('env(NULL_VAR)');
+ $bag->resolve();
+
+ $this->assertNull($bag->all()['env(null_var)']);
+ }
+
+ /**
+ * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
+ * @expectedExceptionMessage The default value of an env() parameter must be scalar or null, but "array" given to "env(ARRAY_VAR)".
+ */
+ public function testGetThrowsOnBadDefaultValue()
+ {
+ $bag = new EnvPlaceholderParameterBag();
+ $bag->set('env(ARRAY_VAR)', array());
+ $bag->get('env(ARRAY_VAR)');
+ $bag->resolve();
+ }
}
diff --git a/src/Symfony/Component/DomCrawler/Crawler.php b/src/Symfony/Component/DomCrawler/Crawler.php
index ea26b4df6625d..33a15900cad5e 100644
--- a/src/Symfony/Component/DomCrawler/Crawler.php
+++ b/src/Symfony/Component/DomCrawler/Crawler.php
@@ -930,7 +930,7 @@ public static function xpathLiteral($s)
}
}
- return sprintf('concat(%s)', implode($parts, ', '));
+ return sprintf('concat(%s)', implode(', ', $parts));
}
/**
diff --git a/src/Symfony/Component/DomCrawler/Field/ChoiceFormField.php b/src/Symfony/Component/DomCrawler/Field/ChoiceFormField.php
index c429417c25f80..c479daa75ee78 100644
--- a/src/Symfony/Component/DomCrawler/Field/ChoiceFormField.php
+++ b/src/Symfony/Component/DomCrawler/Field/ChoiceFormField.php
@@ -155,11 +155,11 @@ public function setValue($value)
/**
* Adds a choice to the current ones.
*
- * This method should only be used internally.
- *
* @param \DOMElement $node
*
* @throws \LogicException When choice provided is not multiple nor radio
+ *
+ * @internal
*/
public function addChoice(\DOMElement $node)
{
diff --git a/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php b/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php
index 1aeac3ad264f0..c1ec8a4139114 100644
--- a/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php
+++ b/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php
@@ -1388,7 +1388,7 @@ public function testDumpFileWithFileScheme()
$scheme = 'file://';
$filename = $scheme.$this->workspace.DIRECTORY_SEPARATOR.'foo'.DIRECTORY_SEPARATOR.'baz.txt';
- $this->filesystem->dumpFile($filename, 'bar', null);
+ $this->filesystem->dumpFile($filename, 'bar');
$this->assertFileExists($filename);
$this->assertSame('bar', file_get_contents($filename));
@@ -1399,7 +1399,7 @@ public function testDumpFileWithZlibScheme()
$scheme = 'compress.zlib://';
$filename = $this->workspace.DIRECTORY_SEPARATOR.'foo'.DIRECTORY_SEPARATOR.'baz.txt';
- $this->filesystem->dumpFile($filename, 'bar', null);
+ $this->filesystem->dumpFile($filename, 'bar');
// Zlib stat uses file:// wrapper so remove scheme
$this->assertFileExists(str_replace($scheme, '', $filename));
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformerTest.php
index 3295e3d85fe8c..af6443ac84054 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformerTest.php
@@ -87,7 +87,7 @@ public function testTransformWithRounding($input, $output, $roundingMode)
public function testReverseTransform()
{
// Since we test against "de_AT", we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault('de_AT');
@@ -109,7 +109,7 @@ public function testReverseTransformEmpty()
public function testReverseTransformWithGrouping()
{
// Since we test against "de_DE", we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault('de_DE');
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/MoneyToLocalizedStringTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/MoneyToLocalizedStringTransformerTest.php
index 99e4c8a574cf2..0fa2df05641a4 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/MoneyToLocalizedStringTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/MoneyToLocalizedStringTransformerTest.php
@@ -19,7 +19,7 @@ class MoneyToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase
public function testTransform()
{
// Since we test against "de_AT", we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault('de_AT');
@@ -47,7 +47,7 @@ public function testTransformEmpty()
public function testReverseTransform()
{
// Since we test against "de_AT", we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault('de_AT');
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/NumberToLocalizedStringTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/NumberToLocalizedStringTransformerTest.php
index 2452796a6935f..306cd225b20f2 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/NumberToLocalizedStringTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/NumberToLocalizedStringTransformerTest.php
@@ -42,7 +42,7 @@ public function provideTransformations()
public function testTransform($from, $to, $locale)
{
// Since we test against other locales, we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault($locale);
@@ -68,7 +68,7 @@ public function provideTransformationsWithGrouping()
public function testTransformWithGrouping($from, $to, $locale)
{
// Since we test against other locales, we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault($locale);
@@ -80,7 +80,7 @@ public function testTransformWithGrouping($from, $to, $locale)
public function testTransformWithScale()
{
// Since we test against "de_AT", we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault('de_AT');
@@ -185,7 +185,7 @@ public function transformWithRoundingProvider()
public function testTransformWithRounding($scale, $input, $output, $roundingMode)
{
// Since we test against "de_AT", we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault('de_AT');
@@ -197,7 +197,7 @@ public function testTransformWithRounding($scale, $input, $output, $roundingMode
public function testTransformDoesNotRoundIfNoScale()
{
// Since we test against "de_AT", we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault('de_AT');
@@ -212,7 +212,7 @@ public function testTransformDoesNotRoundIfNoScale()
public function testReverseTransform($to, $from, $locale)
{
// Since we test against other locales, we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault($locale);
@@ -227,7 +227,7 @@ public function testReverseTransform($to, $from, $locale)
public function testReverseTransformWithGrouping($to, $from, $locale)
{
// Since we test against other locales, we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault($locale);
@@ -242,7 +242,7 @@ public function testReverseTransformWithGrouping($to, $from, $locale)
public function testReverseTransformWithGroupingAndFixedSpaces()
{
// Since we test against other locales, we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault('ru');
@@ -254,7 +254,7 @@ public function testReverseTransformWithGroupingAndFixedSpaces()
public function testReverseTransformWithGroupingButWithoutGroupSeparator()
{
// Since we test against "de_AT", we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault('de_AT');
@@ -374,7 +374,7 @@ public function testReverseTransformDoesNotRoundIfNoScale()
public function testDecimalSeparatorMayBeDotIfGroupingSeparatorIsNotDot()
{
// Since we test against other locales, we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault('fr');
$transformer = new NumberToLocalizedStringTransformer(null, true);
@@ -394,7 +394,7 @@ public function testDecimalSeparatorMayBeDotIfGroupingSeparatorIsNotDot()
public function testDecimalSeparatorMayNotBeDotIfGroupingSeparatorIsDot()
{
// Since we test against "de_DE", we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault('de_DE');
@@ -409,7 +409,7 @@ public function testDecimalSeparatorMayNotBeDotIfGroupingSeparatorIsDot()
public function testDecimalSeparatorMayNotBeDotIfGroupingSeparatorIsDotWithNoGroupSep()
{
// Since we test against "de_DE", we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault('de_DE');
@@ -421,7 +421,7 @@ public function testDecimalSeparatorMayNotBeDotIfGroupingSeparatorIsDotWithNoGro
public function testDecimalSeparatorMayBeDotIfGroupingSeparatorIsDotButNoGroupingUsed()
{
// Since we test against other locales, we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault('fr');
$transformer = new NumberToLocalizedStringTransformer();
@@ -433,7 +433,7 @@ public function testDecimalSeparatorMayBeDotIfGroupingSeparatorIsDotButNoGroupin
public function testDecimalSeparatorMayBeCommaIfGroupingSeparatorIsNotComma()
{
// Since we test against other locales, we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault('bg');
$transformer = new NumberToLocalizedStringTransformer(null, true);
@@ -585,7 +585,7 @@ public function testReverseTransformDisallowsCenteredExtraCharacters()
public function testReverseTransformDisallowsCenteredExtraCharactersMultibyte()
{
// Since we test against other locales, we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault('ru');
@@ -601,7 +601,7 @@ public function testReverseTransformDisallowsCenteredExtraCharactersMultibyte()
public function testReverseTransformIgnoresTrailingSpacesInExceptionMessage()
{
// Since we test against other locales, we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault('ru');
@@ -628,7 +628,7 @@ public function testReverseTransformDisallowsTrailingExtraCharacters()
public function testReverseTransformDisallowsTrailingExtraCharactersMultibyte()
{
// Since we test against other locales, we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault('ru');
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/PercentToLocalizedStringTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/PercentToLocalizedStringTransformerTest.php
index 99f06741b90d7..c0447656f3e51 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/PercentToLocalizedStringTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/PercentToLocalizedStringTransformerTest.php
@@ -53,7 +53,7 @@ public function testTransformWithInteger()
public function testTransformWithScale()
{
// Since we test against "de_AT", we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault('de_AT');
@@ -92,7 +92,7 @@ public function testReverseTransformWithInteger()
public function testReverseTransformWithScale()
{
// Since we test against "de_AT", we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault('de_AT');
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/CountryTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/CountryTypeTest.php
index fb7c4b0bde6f8..e006e075d4c78 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/CountryTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/CountryTypeTest.php
@@ -19,7 +19,7 @@ class CountryTypeTest extends TestCase
{
protected function setUp()
{
- IntlTestHelper::requireIntl($this);
+ IntlTestHelper::requireIntl($this, false);
parent::setUp();
}
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/CurrencyTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/CurrencyTypeTest.php
index 25e7fdddb9488..cd894a52c3260 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/CurrencyTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/CurrencyTypeTest.php
@@ -19,7 +19,7 @@ class CurrencyTypeTest extends TestCase
{
protected function setUp()
{
- IntlTestHelper::requireIntl($this);
+ IntlTestHelper::requireIntl($this, false);
parent::setUp();
}
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php
index 1ee36fe0d6660..9b33db2a654ac 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php
@@ -70,7 +70,7 @@ public function testSubmitFromSingleTextDateTimeWithDefaultFormat()
public function testSubmitFromSingleTextDateTime()
{
// we test against "de_AT", so we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault('de_AT');
@@ -91,7 +91,7 @@ public function testSubmitFromSingleTextDateTime()
public function testSubmitFromSingleTextString()
{
// we test against "de_AT", so we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault('de_AT');
@@ -112,7 +112,7 @@ public function testSubmitFromSingleTextString()
public function testSubmitFromSingleTextTimestamp()
{
// we test against "de_AT", so we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault('de_AT');
@@ -135,7 +135,7 @@ public function testSubmitFromSingleTextTimestamp()
public function testSubmitFromSingleTextRaw()
{
// we test against "de_AT", so we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault('de_AT');
@@ -399,7 +399,7 @@ public function testThrowExceptionIfDaysIsInvalid()
public function testSetDataWithNegativeTimezoneOffsetStringInput()
{
// we test against "de_AT", so we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault('de_AT');
@@ -421,7 +421,7 @@ public function testSetDataWithNegativeTimezoneOffsetStringInput()
public function testSetDataWithNegativeTimezoneOffsetDateTimeInput()
{
// we test against "de_AT", so we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault('de_AT');
@@ -495,7 +495,7 @@ public function testMonthsOptionShortFormat()
public function testMonthsOptionLongFormat()
{
// we test against "de_AT", so we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault('de_AT');
@@ -515,7 +515,7 @@ public function testMonthsOptionLongFormat()
public function testMonthsOptionLongFormatWithDifferentTimezone()
{
// we test against "de_AT", so we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault('de_AT');
@@ -621,7 +621,7 @@ public function testIsPartiallyFilledReturnsTrueIfChoiceAndDayEmpty()
public function testPassDatePatternToView()
{
// we test against "de_AT", so we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault('de_AT');
@@ -634,7 +634,7 @@ public function testPassDatePatternToView()
public function testPassDatePatternToViewDifferentFormat()
{
// we test against "de_AT", so we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault('de_AT');
@@ -682,7 +682,7 @@ public function testDontPassDatePatternIfText()
public function testDatePatternFormatWithQuotedStrings()
{
// we test against "es_ES", so we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault('es_ES');
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/IntegerTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/IntegerTypeTest.php
index dd1a7c549f082..c5a6236d1b13e 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/IntegerTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/IntegerTypeTest.php
@@ -18,7 +18,7 @@ class IntegerTypeTest extends TestCase
{
protected function setUp()
{
- IntlTestHelper::requireIntl($this);
+ IntlTestHelper::requireIntl($this, false);
parent::setUp();
}
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/LanguageTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/LanguageTypeTest.php
index cb59fa2001f48..ca03ef3205aa3 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/LanguageTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/LanguageTypeTest.php
@@ -19,7 +19,7 @@ class LanguageTypeTest extends TestCase
{
protected function setUp()
{
- IntlTestHelper::requireIntl($this);
+ IntlTestHelper::requireIntl($this, false);
parent::setUp();
}
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/LocaleTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/LocaleTypeTest.php
index 8c56bcc9584f3..2a46755bdc64e 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/LocaleTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/LocaleTypeTest.php
@@ -19,7 +19,7 @@ class LocaleTypeTest extends TestCase
{
protected function setUp()
{
- IntlTestHelper::requireIntl($this);
+ IntlTestHelper::requireIntl($this, false);
parent::setUp();
}
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/MoneyTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/MoneyTypeTest.php
index bd01f8eda2396..3938454c3a4a4 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/MoneyTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/MoneyTypeTest.php
@@ -20,7 +20,7 @@ protected function setUp()
{
// we test against different locales, so we need the full
// implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
parent::setUp();
}
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/NumberTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/NumberTypeTest.php
index 1020260d96849..b8675d2684679 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/NumberTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/NumberTypeTest.php
@@ -21,7 +21,7 @@ protected function setUp()
parent::setUp();
// we test against "de_DE", so we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault('de_DE');
}
diff --git a/src/Symfony/Component/Form/Util/OrderedHashMapIterator.php b/src/Symfony/Component/Form/Util/OrderedHashMapIterator.php
index 32f591c860698..534d74ea6f0e4 100644
--- a/src/Symfony/Component/Form/Util/OrderedHashMapIterator.php
+++ b/src/Symfony/Component/Form/Util/OrderedHashMapIterator.php
@@ -14,9 +14,9 @@
/**
* Iterator for {@link OrderedHashMap} objects.
*
- * This class is internal and should not be used.
- *
* @author Bernhard Schussek
+ *
+ * @internal
*/
class OrderedHashMapIterator implements \Iterator
{
diff --git a/src/Symfony/Component/HttpFoundation/BinaryFileResponse.php b/src/Symfony/Component/HttpFoundation/BinaryFileResponse.php
index a39984dffa717..f95d90c364051 100644
--- a/src/Symfony/Component/HttpFoundation/BinaryFileResponse.php
+++ b/src/Symfony/Component/HttpFoundation/BinaryFileResponse.php
@@ -190,7 +190,7 @@ public function prepare(Request $request)
if (!$this->headers->has('Accept-Ranges')) {
// Only accept ranges on safe HTTP methods
- $this->headers->set('Accept-Ranges', $request->isMethodSafe() ? 'bytes' : 'none');
+ $this->headers->set('Accept-Ranges', $request->isMethodSafe(false) ? 'bytes' : 'none');
}
if (!$this->headers->has('Content-Type')) {
diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php
index f857ac74fc3be..4c383ec69da20 100644
--- a/src/Symfony/Component/HttpFoundation/Request.php
+++ b/src/Symfony/Component/HttpFoundation/Request.php
@@ -1475,10 +1475,22 @@ public function isMethod($method)
/**
* Checks whether or not the method is safe.
*
+ * @see https://tools.ietf.org/html/rfc7231#section-4.2.1
+ *
+ * @param bool $andCacheable Adds the additional condition that the method should be cacheable. True by default.
+ *
* @return bool
*/
- public function isMethodSafe()
+ public function isMethodSafe(/* $andCacheable = true */)
{
+ if (!func_num_args() || func_get_arg(0)) {
+ // This deprecation should be turned into a BadMethodCallException in 4.0 (without adding the argument in the signature)
+ // then setting $andCacheable to false should be deprecated in 4.1
+ @trigger_error('Checking only for cacheable HTTP methods with Symfony\Component\HttpFoundation\Request::isMethodSafe() is deprecated since version 3.2 and will throw an exception in 4.0. Disable checking only for cacheable methods by calling the method with `false` as first argument or use the Request::isMethodCacheable() instead.', E_USER_DEPRECATED);
+
+ return in_array($this->getMethod(), array('GET', 'HEAD'));
+ }
+
return in_array($this->getMethod(), array('GET', 'HEAD', 'OPTIONS', 'TRACE'));
}
@@ -1495,6 +1507,8 @@ public function isMethodIdempotent()
/**
* Checks whether the method is cacheable or not.
*
+ * @see https://tools.ietf.org/html/rfc7231#section-4.2.3
+ *
* @return bool
*/
public function isMethodCacheable()
diff --git a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php
index 238be7601d321..9e8e5fe71c750 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php
@@ -1994,7 +1994,7 @@ public function testMethodSafe($method, $safe)
{
$request = new Request();
$request->setMethod($method);
- $this->assertEquals($safe, $request->isMethodSafe());
+ $this->assertEquals($safe, $request->isMethodSafe(false));
}
public function methodSafeProvider()
@@ -2013,6 +2013,17 @@ public function methodSafeProvider()
);
}
+ /**
+ * @group legacy
+ * @expectedDeprecation Checking only for cacheable HTTP methods with Symfony\Component\HttpFoundation\Request::isMethodSafe() is deprecated since version 3.2 and will throw an exception in 4.0. Disable checking only for cacheable methods by calling the method with `false` as first argument or use the Request::isMethodCacheable() instead.
+ */
+ public function testMethodSafeChecksCacheable()
+ {
+ $request = new Request();
+ $request->setMethod('OPTIONS');
+ $this->assertFalse($request->isMethodSafe());
+ }
+
/**
* @dataProvider methodCacheableProvider
*/
diff --git a/src/Symfony/Component/HttpKernel/DataCollector/DataCollector.php b/src/Symfony/Component/HttpKernel/DataCollector/DataCollector.php
index 1f8538a9f2522..7bca1ddfe199f 100644
--- a/src/Symfony/Component/HttpKernel/DataCollector/DataCollector.php
+++ b/src/Symfony/Component/HttpKernel/DataCollector/DataCollector.php
@@ -130,7 +130,7 @@ private function decorateVar($var)
return new ClassStub($var);
}
}
- if (false !== strpos($var, DIRECTORY_SEPARATOR) && false === strpos($var, '://') && file_exists($var)) {
+ if (false !== strpos($var, DIRECTORY_SEPARATOR) && false === strpos($var, '://') && false === strpos($var, "\0") && is_file($var)) {
return new LinkStub($var);
}
}
diff --git a/src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php b/src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php
index f0c18c51e51e7..55c2f0e6f50a4 100644
--- a/src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php
+++ b/src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php
@@ -12,10 +12,8 @@
namespace Symfony\Component\HttpKernel\DataCollector;
use Symfony\Component\HttpFoundation\ParameterBag;
-use Symfony\Component\HttpFoundation\HeaderBag;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
-use Symfony\Component\HttpFoundation\ResponseHeaderBag;
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\HttpKernel\Event\FilterControllerEvent;
@@ -54,14 +52,11 @@ public function collect(Request $request, Response $response, \Exception $except
$attributes = array();
$route = '';
foreach ($request->attributes->all() as $key => $value) {
- if ('_route' === $key && is_object($value)) {
- $attributes[$key] = $this->cloneVar($value->getPath());
- } else {
- $attributes[$key] = $this->cloneVar($value);
- }
-
if ('_route' === $key) {
$route = is_object($value) ? $value->getPath() : $value;
+ $attributes[$key] = $route;
+ } else {
+ $attributes[$key] = $value;
}
}
@@ -97,8 +92,8 @@ public function collect(Request $request, Response $response, \Exception $except
'content_type' => $response->headers->get('Content-Type', 'text/html'),
'status_text' => isset(Response::$statusTexts[$statusCode]) ? Response::$statusTexts[$statusCode] : '',
'status_code' => $statusCode,
- 'request_query' => array_map(array($this, 'cloneVar'), $request->query->all()),
- 'request_request' => array_map(array($this, 'cloneVar'), $request->request->all()),
+ 'request_query' => $request->query->all(),
+ 'request_request' => $request->request->all(),
'request_headers' => $request->headers->all(),
'request_server' => $request->server->all(),
'request_cookies' => $request->cookies->all(),
@@ -125,6 +120,18 @@ public function collect(Request $request, Response $response, \Exception $except
$this->data['request_request']['_password'] = '******';
}
+ foreach ($this->data as $key => $value) {
+ if (!is_array($value)) {
+ continue;
+ }
+ if ('request_headers' === $key || 'response_headers' === $key) {
+ $value = array_map(function ($v) { return isset($v[1]) ? $v : $v[0]; }, $value);
+ }
+ if ('request_server' !== $key && 'request_cookies' !== $key) {
+ $this->data[$key] = array_map(array($this, 'cloneVar'), $value);
+ }
+ }
+
if (isset($this->controllers[$request])) {
$this->data['controller'] = $this->parseController($this->controllers[$request]);
unset($this->controllers[$request]);
@@ -170,17 +177,17 @@ public function getRequestQuery()
public function getRequestHeaders()
{
- return new HeaderBag($this->data['request_headers']);
+ return new ParameterBag($this->data['request_headers']);
}
- public function getRequestServer()
+ public function getRequestServer($raw = false)
{
- return new ParameterBag($this->data['request_server']);
+ return new ParameterBag($raw ? $this->data['request_server'] : array_map(array($this, 'cloneVar'), $this->data['request_server']));
}
- public function getRequestCookies()
+ public function getRequestCookies($raw = false)
{
- return new ParameterBag($this->data['request_cookies']);
+ return new ParameterBag($raw ? $this->data['request_cookies'] : array_map(array($this, 'cloneVar'), $this->data['request_cookies']));
}
public function getRequestAttributes()
@@ -190,7 +197,7 @@ public function getRequestAttributes()
public function getResponseHeaders()
{
- return new ResponseHeaderBag($this->data['response_headers']);
+ return new ParameterBag($this->data['response_headers']);
}
public function getSessionMetadata()
@@ -264,7 +271,17 @@ public function getIdentifier()
*/
public function getRouteParams()
{
- return isset($this->data['request_attributes']['_route_params']) ? $this->data['request_attributes']['_route_params'] : $this->cloneVar(array());
+ if (!isset($this->data['request_attributes']['_route_params'])) {
+ return array();
+ }
+
+ $data = $this->data['request_attributes']['_route_params'];
+ $params = array();
+ foreach ($data->getRawData()[1] as $k => $v) {
+ $params[$k] = $data->seek($k);
+ }
+
+ return $params;
}
/**
diff --git a/src/Symfony/Component/HttpKernel/EventListener/FragmentListener.php b/src/Symfony/Component/HttpKernel/EventListener/FragmentListener.php
index 9fdaccfaf6857..37bf15c3a084f 100644
--- a/src/Symfony/Component/HttpKernel/EventListener/FragmentListener.php
+++ b/src/Symfony/Component/HttpKernel/EventListener/FragmentListener.php
@@ -81,7 +81,7 @@ public function onKernelRequest(GetResponseEvent $event)
protected function validateRequest(Request $request)
{
// is the Request safe?
- if (!$request->isMethodSafe()) {
+ if (!$request->isMethodSafe(false)) {
throw new AccessDeniedHttpException();
}
diff --git a/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php b/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php
index 3e7ff0aab8251..686f0b852c202 100644
--- a/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php
+++ b/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php
@@ -182,7 +182,7 @@ public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQ
}
$this->traces[$request->getMethod().' '.$path] = array();
- if (!$request->isMethodSafe()) {
+ if (!$request->isMethodSafe(false)) {
$response = $this->invalidate($request, $catch);
} elseif ($request->headers->has('expect') || !$request->isMethodCacheable()) {
$response = $this->pass($request, $catch);
diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php
index e4ca24c4851cf..0bd98579b5a7a 100644
--- a/src/Symfony/Component/HttpKernel/Kernel.php
+++ b/src/Symfony/Component/HttpKernel/Kernel.php
@@ -58,12 +58,12 @@ abstract class Kernel implements KernelInterface, TerminableInterface
protected $startTime;
protected $loadClassCache;
- const VERSION = '3.2.0-RC1';
+ const VERSION = '3.2.0-RC2';
const VERSION_ID = 30200;
const MAJOR_VERSION = 3;
const MINOR_VERSION = 2;
const RELEASE_VERSION = 0;
- const EXTRA_VERSION = 'RC1';
+ const EXTRA_VERSION = 'RC2';
const END_OF_MAINTENANCE = '07/2017';
const END_OF_LIFE = '01/2018';
diff --git a/src/Symfony/Component/HttpKernel/Tests/DataCollector/RequestDataCollectorTest.php b/src/Symfony/Component/HttpKernel/Tests/DataCollector/RequestDataCollectorTest.php
index 2ae1c5c09bb49..245cd4c159693 100644
--- a/src/Symfony/Component/HttpKernel/Tests/DataCollector/RequestDataCollectorTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/DataCollector/RequestDataCollectorTest.php
@@ -39,7 +39,7 @@ public function testCollect()
$attributes = $c->getRequestAttributes();
$this->assertSame('request', $c->getName());
- $this->assertInstanceOf('Symfony\Component\HttpFoundation\HeaderBag', $c->getRequestHeaders());
+ $this->assertInstanceOf('Symfony\Component\HttpFoundation\ParameterBag', $c->getRequestHeaders());
$this->assertInstanceOf('Symfony\Component\HttpFoundation\ParameterBag', $c->getRequestServer());
$this->assertInstanceOf('Symfony\Component\HttpFoundation\ParameterBag', $c->getRequestCookies());
$this->assertInstanceOf('Symfony\Component\HttpFoundation\ParameterBag', $attributes);
@@ -47,13 +47,13 @@ public function testCollect()
$this->assertInstanceOf('Symfony\Component\HttpFoundation\ParameterBag', $c->getRequestQuery());
$this->assertSame('html', $c->getFormat());
$this->assertEquals('foobar', $c->getRoute());
- $this->assertEquals($cloner->cloneVar(array('name' => 'foo')), $c->getRouteParams());
+ $this->assertEquals(array('name' => $cloner->cloneVar(array('name' => 'foo'))->seek('name')), $c->getRouteParams());
$this->assertSame(array(), $c->getSessionAttributes());
$this->assertSame('en', $c->getLocale());
$this->assertEquals($cloner->cloneVar($request->attributes->get('resource')), $attributes->get('resource'));
$this->assertEquals($cloner->cloneVar($request->attributes->get('object')), $attributes->get('object'));
- $this->assertInstanceOf('Symfony\Component\HttpFoundation\HeaderBag', $c->getResponseHeaders());
+ $this->assertInstanceOf('Symfony\Component\HttpFoundation\ParameterBag', $c->getResponseHeaders());
$this->assertSame('OK', $c->getStatusText());
$this->assertSame(200, $c->getStatusCode());
$this->assertSame('application/json', $c->getContentType());
diff --git a/src/Symfony/Component/Intl/Tests/Collator/Verification/CollatorTest.php b/src/Symfony/Component/Intl/Tests/Collator/Verification/CollatorTest.php
index 5da56cc9af8c8..378463cac854e 100644
--- a/src/Symfony/Component/Intl/Tests/Collator/Verification/CollatorTest.php
+++ b/src/Symfony/Component/Intl/Tests/Collator/Verification/CollatorTest.php
@@ -24,7 +24,7 @@ class CollatorTest extends AbstractCollatorTest
{
protected function setUp()
{
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
parent::setUp();
}
diff --git a/src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php b/src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php
index 931aa2bad0754..621fd33e5d7f9 100644
--- a/src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php
+++ b/src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php
@@ -832,9 +832,7 @@ protected function getDateTime($timestamp, $timeZone)
{
$dateTime = new \DateTime();
$dateTime->setTimestamp(null === $timestamp ? time() : $timestamp);
- if (null !== $timeZone) {
- $dateTime->setTimezone(new \DateTimeZone($timeZone));
- }
+ $dateTime->setTimezone(new \DateTimeZone($timeZone ?: getenv('TZ') ?: 'UTC'));
return $dateTime;
}
diff --git a/src/Symfony/Component/Intl/Tests/DateFormatter/Verification/IntlDateFormatterTest.php b/src/Symfony/Component/Intl/Tests/DateFormatter/Verification/IntlDateFormatterTest.php
index 7eca02e2072ae..a5d20638c1ebe 100644
--- a/src/Symfony/Component/Intl/Tests/DateFormatter/Verification/IntlDateFormatterTest.php
+++ b/src/Symfony/Component/Intl/Tests/DateFormatter/Verification/IntlDateFormatterTest.php
@@ -25,13 +25,15 @@ class IntlDateFormatterTest extends AbstractIntlDateFormatterTest
{
protected function setUp()
{
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
parent::setUp();
}
protected function getDateFormatter($locale, $datetype, $timetype, $timezone = null, $calendar = IntlDateFormatter::GREGORIAN, $pattern = null)
{
+ IntlTestHelper::requireFullIntl($this, '55.1');
+
if (!$formatter = new \IntlDateFormatter($locale, $datetype, $timetype, $timezone, $calendar, $pattern)) {
throw new \InvalidArgumentException(intl_get_error_message());
}
diff --git a/src/Symfony/Component/Intl/Tests/Globals/Verification/IntlGlobalsTest.php b/src/Symfony/Component/Intl/Tests/Globals/Verification/IntlGlobalsTest.php
index c46033d8805a9..b5cd1c13c32ff 100644
--- a/src/Symfony/Component/Intl/Tests/Globals/Verification/IntlGlobalsTest.php
+++ b/src/Symfony/Component/Intl/Tests/Globals/Verification/IntlGlobalsTest.php
@@ -24,7 +24,7 @@ class IntlGlobalsTest extends AbstractIntlGlobalsTest
{
protected function setUp()
{
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
parent::setUp();
}
diff --git a/src/Symfony/Component/Intl/Tests/Locale/Verification/LocaleTest.php b/src/Symfony/Component/Intl/Tests/Locale/Verification/LocaleTest.php
index 39d4f3cb03b36..adfec280a7997 100644
--- a/src/Symfony/Component/Intl/Tests/Locale/Verification/LocaleTest.php
+++ b/src/Symfony/Component/Intl/Tests/Locale/Verification/LocaleTest.php
@@ -24,7 +24,7 @@ class LocaleTest extends AbstractLocaleTest
{
protected function setUp()
{
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
parent::setUp();
}
diff --git a/src/Symfony/Component/Intl/Tests/NumberFormatter/Verification/NumberFormatterTest.php b/src/Symfony/Component/Intl/Tests/NumberFormatter/Verification/NumberFormatterTest.php
index 28e6fe9090302..181b489c1564d 100644
--- a/src/Symfony/Component/Intl/Tests/NumberFormatter/Verification/NumberFormatterTest.php
+++ b/src/Symfony/Component/Intl/Tests/NumberFormatter/Verification/NumberFormatterTest.php
@@ -22,7 +22,7 @@ class NumberFormatterTest extends AbstractNumberFormatterTest
{
protected function setUp()
{
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, '55.1');
parent::setUp();
}
@@ -32,6 +32,13 @@ public function testCreate()
$this->assertInstanceOf('\NumberFormatter', \NumberFormatter::create('en', \NumberFormatter::DECIMAL));
}
+ public function testGetTextAttribute()
+ {
+ IntlTestHelper::requireFullIntl($this);
+
+ parent::testGetTextAttribute();
+ }
+
protected function getNumberFormatter($locale = 'en', $style = null, $pattern = null)
{
return new \NumberFormatter($locale, $style, $pattern);
diff --git a/src/Symfony/Component/Intl/Util/IntlTestHelper.php b/src/Symfony/Component/Intl/Util/IntlTestHelper.php
index ecd5ed6b660d6..71fb4acdd72fa 100644
--- a/src/Symfony/Component/Intl/Util/IntlTestHelper.php
+++ b/src/Symfony/Component/Intl/Util/IntlTestHelper.php
@@ -28,19 +28,21 @@ class IntlTestHelper
{
/**
* Should be called before tests that work fine with the stub implementation.
- *
- * @param \PhpUnit_Framework_TestCase $testCase
*/
- public static function requireIntl(\PHPUnit_Framework_TestCase $testCase)
+ public static function requireIntl(\PHPUnit_Framework_TestCase $testCase, $minimumIcuVersion = null)
{
+ if (null === $minimumIcuVersion) {
+ $minimumIcuVersion = Intl::getIcuStubVersion();
+ }
+
// We only run tests if the version is *one specific version*.
// This condition is satisfied if
//
// * the intl extension is loaded with version Intl::getIcuStubVersion()
// * the intl extension is not loaded
- if (IcuVersion::compare(Intl::getIcuVersion(), Intl::getIcuStubVersion(), '!=', 1)) {
- $testCase->markTestSkipped('ICU version '.Intl::getIcuStubVersion().' is required.');
+ if (($minimumIcuVersion || defined('HHVM_VERSION_ID')) && IcuVersion::compare(Intl::getIcuVersion(), $minimumIcuVersion, '!=', 1)) {
+ $testCase->markTestSkipped('ICU version '.$minimumIcuVersion.' is required.');
}
// Normalize the default locale in case this is not done explicitly
@@ -60,24 +62,15 @@ public static function requireIntl(\PHPUnit_Framework_TestCase $testCase)
/**
* Should be called before tests that require a feature-complete intl
* implementation.
- *
- * @param \PhpUnit_Framework_TestCase $testCase
*/
- public static function requireFullIntl(\PHPUnit_Framework_TestCase $testCase)
+ public static function requireFullIntl(\PHPUnit_Framework_TestCase $testCase, $minimumIcuVersion = null)
{
// We only run tests if the intl extension is loaded...
if (!Intl::isExtensionLoaded()) {
$testCase->markTestSkipped('Extension intl is required.');
}
- // ... and only if the version is *one specific version*
- if (IcuVersion::compare(Intl::getIcuVersion(), Intl::getIcuStubVersion(), '!=', 1)) {
- $testCase->markTestSkipped('ICU version '.Intl::getIcuStubVersion().' is required.');
- }
-
- // Normalize the default locale in case this is not done explicitly
- // in the test
- \Locale::setDefault('en');
+ self::requireIntl($testCase, $minimumIcuVersion);
// Consequently, tests will
//
@@ -89,8 +82,6 @@ public static function requireFullIntl(\PHPUnit_Framework_TestCase $testCase)
/**
* Skips the test unless the current system has a 32bit architecture.
- *
- * @param \PhpUnit_Framework_TestCase $testCase
*/
public static function require32Bit(\PHPUnit_Framework_TestCase $testCase)
{
@@ -101,8 +92,6 @@ public static function require32Bit(\PHPUnit_Framework_TestCase $testCase)
/**
* Skips the test unless the current system has a 64bit architecture.
- *
- * @param \PhpUnit_Framework_TestCase $testCase
*/
public static function require64Bit(\PHPUnit_Framework_TestCase $testCase)
{
diff --git a/src/Symfony/Component/Process/Process.php b/src/Symfony/Component/Process/Process.php
index 39493d72e01ab..6282f17be2296 100644
--- a/src/Symfony/Component/Process/Process.php
+++ b/src/Symfony/Component/Process/Process.php
@@ -573,6 +573,7 @@ public function getIterator($flags = 0)
yield self::OUT => '';
}
+ $this->checkTimeout();
$this->readPipesForOutput(__FUNCTION__, $blocking);
}
}
@@ -992,8 +993,16 @@ public function setTty($tty)
if ('\\' === DIRECTORY_SEPARATOR && $tty) {
throw new RuntimeException('TTY mode is not supported on Windows platform.');
}
- if ($tty && (!file_exists('/dev/tty') || !is_readable('/dev/tty'))) {
- throw new RuntimeException('TTY mode requires /dev/tty to be readable.');
+ if ($tty) {
+ static $isTtySupported;
+
+ if (null === $isTtySupported) {
+ $isTtySupported = (bool) @proc_open('echo 1 >/dev/null', array(array('file', '/dev/tty', 'r'), array('file', '/dev/tty', 'w'), array('file', '/dev/tty', 'w')), $pipes);
+ }
+
+ if (!$isTtySupported) {
+ throw new RuntimeException('TTY mode requires /dev/tty to be read/writable.');
+ }
}
$this->tty = (bool) $tty;
@@ -1281,7 +1290,7 @@ public static function isPtySupported()
return $result = false;
}
- return $result = (bool) @proc_open('echo 1', array(array('pty'), array('pty'), array('pty')), $pipes);
+ return $result = (bool) @proc_open('echo 1 >/dev/null', array(array('pty'), array('pty'), array('pty')), $pipes);
}
/**
diff --git a/src/Symfony/Component/Process/Tests/ProcessTest.php b/src/Symfony/Component/Process/Tests/ProcessTest.php
index c0bc6d48598f1..811c98f15e7d8 100644
--- a/src/Symfony/Component/Process/Tests/ProcessTest.php
+++ b/src/Symfony/Component/Process/Tests/ProcessTest.php
@@ -747,6 +747,27 @@ public function testRunProcessWithTimeout()
throw $e;
}
+ /**
+ * @expectedException \Symfony\Component\Process\Exception\ProcessTimedOutException
+ * @expectedExceptionMessage exceeded the timeout of 0.1 seconds.
+ */
+ public function testIterateOverProcessWithTimeout()
+ {
+ $process = $this->getProcess(self::$phpBin.' -r "sleep(30);"');
+ $process->setTimeout(0.1);
+ $start = microtime(true);
+ try {
+ $process->start();
+ foreach ($process as $buffer);
+ $this->fail('A RuntimeException should have been raised');
+ } catch (RuntimeException $e) {
+ }
+
+ $this->assertLessThan(15, microtime(true) - $start);
+
+ throw $e;
+ }
+
public function testCheckTimeoutOnNonStartedProcess()
{
$process = $this->getProcess('echo foo');
diff --git a/src/Symfony/Component/Routing/RouteCompiler.php b/src/Symfony/Component/Routing/RouteCompiler.php
index 211325d20fb08..aa7a75e0b009b 100644
--- a/src/Symfony/Component/Routing/RouteCompiler.php
+++ b/src/Symfony/Component/Routing/RouteCompiler.php
@@ -28,13 +28,21 @@ class RouteCompiler implements RouteCompilerInterface
*/
const SEPARATORS = '/,;.:-_~+*=@|';
+ /**
+ * The maximum supported length of a PCRE subpattern name
+ * http://pcre.org/current/doc/html/pcre2pattern.html#SEC16.
+ *
+ * @internal
+ */
+ const VARIABLE_MAXIMUM_LENGTH = 32;
+
/**
* {@inheritdoc}
*
* @throws \InvalidArgumentException If a path variable is named _fragment
* @throws \LogicException If a variable is referenced more than once
- * @throws \DomainException If a variable name is numeric because PHP raises an error for such
- * subpatterns in PCRE and thus would break matching, e.g. "(?P<123>.+)".
+ * @throws \DomainException If a variable name starts with a digit or if it is too long to be successfully used as
+ * a PCRE subpattern.
*/
public static function compile(Route $route)
{
@@ -121,13 +129,19 @@ private static function compilePattern(Route $route, $pattern, $isHost)
}
$isSeparator = '' !== $precedingChar && false !== strpos(static::SEPARATORS, $precedingChar);
- if (is_numeric($varName)) {
- throw new \DomainException(sprintf('Variable name "%s" cannot be numeric in route pattern "%s". Please use a different name.', $varName, $pattern));
+ // A PCRE subpattern name must start with a non-digit. Also a PHP variable cannot start with a digit so the
+ // variable would not be usable as a Controller action argument.
+ if (preg_match('/^\d/', $varName)) {
+ throw new \DomainException(sprintf('Variable name "%s" cannot start with a digit in route pattern "%s". Please use a different name.', $varName, $pattern));
}
if (in_array($varName, $variables)) {
throw new \LogicException(sprintf('Route pattern "%s" cannot reference variable name "%s" more than once.', $pattern, $varName));
}
+ if (strlen($varName) > self::VARIABLE_MAXIMUM_LENGTH) {
+ throw new \DomainException(sprintf('Variable name "%s" cannot be longer than %s characters in route pattern "%s". Please use a shorter name.', $varName, self::VARIABLE_MAXIMUM_LENGTH, $pattern));
+ }
+
if ($isSeparator && $precedingText !== $precedingChar) {
$tokens[] = array('text', substr($precedingText, 0, -strlen($precedingChar)));
} elseif (!$isSeparator && strlen($precedingText) > 0) {
diff --git a/src/Symfony/Component/Routing/Tests/RouteCompilerTest.php b/src/Symfony/Component/Routing/Tests/RouteCompilerTest.php
index 79e94a22dc993..3213bf2163e06 100644
--- a/src/Symfony/Component/Routing/Tests/RouteCompilerTest.php
+++ b/src/Symfony/Component/Routing/Tests/RouteCompilerTest.php
@@ -283,16 +283,16 @@ public function testRouteWithFragmentAsPathParameter()
}
/**
- * @dataProvider getNumericVariableNames
+ * @dataProvider getVariableNamesStartingWithADigit
* @expectedException \DomainException
*/
- public function testRouteWithNumericVariableName($name)
+ public function testRouteWithVariableNameStartingWithADigit($name)
{
$route = new Route('/{'.$name.'}');
$route->compile();
}
- public function getNumericVariableNames()
+ public function getVariableNamesStartingWithADigit()
{
return array(
array('09'),
@@ -371,6 +371,15 @@ public function provideCompileWithHostData()
),
);
}
+
+ /**
+ * @expectedException \DomainException
+ */
+ public function testRouteWithTooLongVariableName()
+ {
+ $route = new Route(sprintf('/{%s}', str_repeat('a', RouteCompiler::VARIABLE_MAXIMUM_LENGTH + 1)));
+ $route->compile();
+ }
}
class Utf8RouteCompiler extends RouteCompiler
diff --git a/src/Symfony/Component/Security/Core/Authentication/RememberMe/PersistentToken.php b/src/Symfony/Component/Security/Core/Authentication/RememberMe/PersistentToken.php
index d85572d0e07db..76873fc603cd7 100644
--- a/src/Symfony/Component/Security/Core/Authentication/RememberMe/PersistentToken.php
+++ b/src/Symfony/Component/Security/Core/Authentication/RememberMe/PersistentToken.php
@@ -12,9 +12,9 @@
namespace Symfony\Component\Security\Core\Authentication\RememberMe;
/**
- * This class is only used by PersistentTokenRememberMeServices internally.
- *
* @author Johannes M. Schmitt
+ *
+ * @internal
*/
final class PersistentToken implements PersistentTokenInterface
{
diff --git a/src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php b/src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php
index 98f5ac04be303..3c9604ea7436b 100644
--- a/src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php
+++ b/src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php
@@ -220,7 +220,7 @@ private function startAuthentication(Request $request, AuthenticationException $
protected function setTargetPath(Request $request)
{
// session isn't required when using HTTP basic authentication mechanism for example
- if ($request->hasSession() && $request->isMethodSafe() && !$request->isXmlHttpRequest()) {
+ if ($request->hasSession() && $request->isMethodSafe(false) && !$request->isXmlHttpRequest()) {
$this->saveTargetPath($request->getSession(), $this->providerKey, $request->getUri());
}
}
diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/DateTimeNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/DateTimeNormalizerTest.php
index e68dfe335eb29..6bf6642ff0529 100644
--- a/src/Symfony/Component/Serializer/Tests/Normalizer/DateTimeNormalizerTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Normalizer/DateTimeNormalizerTest.php
@@ -77,9 +77,9 @@ public function testDenormalize()
public function testDenormalizeUsingFormatPassedInContext()
{
- $this->assertEquals(new \DateTimeImmutable('2016/01/01', new \DateTimeZone('UTC')), $this->normalizer->denormalize('2016.01.01', \DateTimeInterface::class, null, array(DateTimeNormalizer::FORMAT_KEY => 'Y.m.d|')));
- $this->assertEquals(new \DateTimeImmutable('2016/01/01', new \DateTimeZone('UTC')), $this->normalizer->denormalize('2016.01.01', \DateTimeImmutable::class, null, array(DateTimeNormalizer::FORMAT_KEY => 'Y.m.d|')));
- $this->assertEquals(new \DateTime('2016/01/01', new \DateTimeZone('UTC')), $this->normalizer->denormalize('2016.01.01', \DateTime::class, null, array(DateTimeNormalizer::FORMAT_KEY => 'Y.m.d|')));
+ $this->assertEquals(new \DateTimeImmutable('2016/01/01'), $this->normalizer->denormalize('2016.01.01', \DateTimeInterface::class, null, array(DateTimeNormalizer::FORMAT_KEY => 'Y.m.d|')));
+ $this->assertEquals(new \DateTimeImmutable('2016/01/01'), $this->normalizer->denormalize('2016.01.01', \DateTimeImmutable::class, null, array(DateTimeNormalizer::FORMAT_KEY => 'Y.m.d|')));
+ $this->assertEquals(new \DateTime('2016/01/01'), $this->normalizer->denormalize('2016.01.01', \DateTime::class, null, array(DateTimeNormalizer::FORMAT_KEY => 'Y.m.d|')));
}
/**
diff --git a/src/Symfony/Component/Translation/Tests/IdentityTranslatorTest.php b/src/Symfony/Component/Translation/Tests/IdentityTranslatorTest.php
index 352dd318dc73c..648c54afd153d 100644
--- a/src/Symfony/Component/Translation/Tests/IdentityTranslatorTest.php
+++ b/src/Symfony/Component/Translation/Tests/IdentityTranslatorTest.php
@@ -60,7 +60,7 @@ public function testGetSetLocale()
public function testGetLocaleReturnsDefaultLocaleIfNotSet()
{
// in order to test with "pt_BR"
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
$translator = new IdentityTranslator();
diff --git a/src/Symfony/Component/Validator/ConstraintValidator.php b/src/Symfony/Component/Validator/ConstraintValidator.php
index ece4400065c6a..965a888af0981 100644
--- a/src/Symfony/Component/Validator/ConstraintValidator.php
+++ b/src/Symfony/Component/Validator/ConstraintValidator.php
@@ -36,7 +36,7 @@ abstract class ConstraintValidator implements ConstraintValidatorInterface
const OBJECT_TO_STRING = 2;
/**
- * @var ExecutionContextInterface
+ * @var ExecutionContextInterface2Dot5
*/
protected $context;
diff --git a/src/Symfony/Component/Validator/README.md b/src/Symfony/Component/Validator/README.md
index 9dfbffb3f545a..3ccb2901adeac 100644
--- a/src/Symfony/Component/Validator/README.md
+++ b/src/Symfony/Component/Validator/README.md
@@ -7,7 +7,7 @@ The Validator component provides tools to validate values following the
Resources
---------
- * [Documentation](https://symfony.com/doc/current/book/validation.html)
+ * [Documentation](https://symfony.com/doc/current/components/validator.html)
* [Contributing](https://symfony.com/doc/current/contributing/index.html)
* [Report issues](https://github.com/symfony/symfony/issues) and
[send Pull Requests](https://github.com/symfony/symfony/pulls)
diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.id.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.id.xlf
index 742f4a163ebd6..c7061470dc16a 100644
--- a/src/Symfony/Component/Validator/Resources/translations/validators.id.xlf
+++ b/src/Symfony/Component/Validator/Resources/translations/validators.id.xlf
@@ -36,11 +36,11 @@
This field was not expected.
- Bidang ini tidak diharapkan.
+ Ruas ini tidak diharapkan.This field is missing.
- Bidang ini hilang.
+ Ruas ini hilang.This value is not a valid date.
@@ -52,15 +52,15 @@
This value is not a valid email address.
- Nilai ini bukan alamat email yang sah.
+ Nilai ini bukan alamat surel yang sah.The file could not be found.
- Berkas tidak ditemukan.
+ Berkas tidak dapat ditemukan.The file is not readable.
- Berkas tidak bisa dibaca.
+ Berkas tidak dapat dibaca.The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}.
@@ -68,7 +68,7 @@
The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}.
- Jenis berkas ({{ type }}) tidak sah. Jenis berkas yang diijinkan adalah {{ types }}.
+ Jenis berkas ({{ type }}) tidak sah. Jenis berkas yang diizinkan adalah {{ types }}.This value should be {{ limit }} or less.
@@ -116,7 +116,7 @@
The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}.
- Ukuran berkas terlalu besar. Ukuran maksimum yang diijinkan adalah {{ limit }} {{ suffix }}.
+ Ukuran berkas terlalu besar. Ukuran maksimum yang diizinkan adalah {{ limit }} {{ suffix }}.The file is too large.
@@ -132,7 +132,7 @@
This file is not a valid image.
- Berkas ini tidak termasuk gambar.
+ Berkas ini tidak termasuk citra.This is not a valid IP address.
@@ -156,23 +156,23 @@
The size of the image could not be detected.
- Ukuran dari gambar tidak bisa dideteksi.
+ Ukuran dari citra tidak bisa dideteksi.The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px.
- Lebar gambar terlalu besar ({{ width }}px). Ukuran lebar maksimum adalah {{ max_width }}px.
+ Lebar citra terlalu besar ({{ width }}px). Ukuran lebar maksimum adalah {{ max_width }}px.The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px.
- Lebar gambar terlalu kecil ({{ width }}px). Ukuran lebar minimum yang diharapkan adalah {{ min_width }}px.
+ Lebar citra terlalu kecil ({{ width }}px). Ukuran lebar minimum yang diharapkan adalah {{ min_width }}px.The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px.
- Tinggi gambar terlalu besar ({{ height }}px). Ukuran tinggi maksimum adalah {{ max_height }}px.
+ Tinggi citra terlalu besar ({{ height }}px). Ukuran tinggi maksimum adalah {{ max_height }}px.The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px.
- Tinggi gambar terlalu kecil ({{ height }}px). Ukuran tinggi minimum yang diharapkan adalah {{ min_height }}px.
+ Tinggi citra terlalu kecil ({{ height }}px). Ukuran tinggi minimum yang diharapkan adalah {{ min_height }}px.This value should be the user's current password.
@@ -278,6 +278,38 @@
This value should not be identical to {{ compared_value_type }} {{ compared_value }}.Nilai ini seharusnya tidak identik dengan {{ compared_value_type }} {{ compared_value }}.
+
+ The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}.
+ Rasio citra terlalu besar ({{ ratio }}). Rasio maksimum yang diizinkan adalah {{ max_ratio }}.
+
+
+ The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}.
+ Rasio citra terlalu kecil ({{ ratio }}). Rasio minimum yang diharapkan adalah {{ min_ratio }}.
+
+
+ The image is square ({{ width }}x{{ height }}px). Square images are not allowed.
+ Citra persegi ({{ width }}x{{ height }}px). Citra persegi tidak diizinkan.
+
+
+ The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed.
+ Citra berorientasi lanskap ({{ width }}x{{ height }}px). Citra berorientasi lanskap tidak diizinkan.
+
+
+ The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed.
+ Citra berorientasi potret ({{ width }}x{{ height }}px). Citra berorientasi potret tidak diizinkan.
+
+
+ An empty file is not allowed.
+ Berkas kosong tidak diizinkan.
+
+
+ The host could not be resolved.
+ Host tidak dapat diselesaikan.
+
+
+ This value does not match the expected {{ charset }} charset.
+ Nilai ini tidak memenuhi set karakter {{ charset }} yang diharapkan.
+