diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd b/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd
index d0aba42703..316ab4bde9 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd
+++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd
@@ -207,6 +207,8 @@
+
+
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/validation_strict_email.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/validation_strict_email.php
new file mode 100644
index 0000000000..64a47a2322
--- /dev/null
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/validation_strict_email.php
@@ -0,0 +1,7 @@
+loadFromExtension('framework', array(
+ 'validation' => array(
+ 'strict_email' => true,
+ ),
+));
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/validation_translation_domain.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/validation_translation_domain.php
new file mode 100644
index 0000000000..40a81d4936
--- /dev/null
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/validation_translation_domain.php
@@ -0,0 +1,7 @@
+loadFromExtension('framework', array(
+ 'validation' => array(
+ 'translation_domain' => 'messages',
+ ),
+));
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/validation_strict_email.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/validation_strict_email.xml
new file mode 100644
index 0000000000..5b4aba1b70
--- /dev/null
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/validation_strict_email.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/validation_translation_domain.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/validation_translation_domain.xml
new file mode 100644
index 0000000000..733d5fa683
--- /dev/null
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/validation_translation_domain.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/validation_strict_email.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/validation_strict_email.yml
new file mode 100644
index 0000000000..1c805f9b92
--- /dev/null
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/validation_strict_email.yml
@@ -0,0 +1,3 @@
+framework:
+ validation:
+ strict_email: true
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/validation_translation_domain.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/validation_translation_domain.yml
new file mode 100644
index 0000000000..167b5fcce8
--- /dev/null
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/validation_translation_domain.yml
@@ -0,0 +1,3 @@
+framework:
+ validation:
+ translation_domain: messages
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php
index cb5c70c174..257283d016 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php
@@ -428,6 +428,20 @@ abstract class FrameworkExtensionTest extends TestCase
// no cache, no annotations, no static methods
}
+ public function testValidationTranslationDomain()
+ {
+ $container = $this->createContainerFromFile('validation_translation_domain');
+
+ $this->assertSame('messages', $container->getParameter('validator.translation_domain'));
+ }
+
+ public function testValidationStrictEmail()
+ {
+ $container = $this->createContainerFromFile('validation_strict_email');
+
+ $this->assertTrue($container->getDefinition('validator.email')->getArgument(0));
+ }
+
public function testFormsCanBeEnabledWithoutCsrfProtection()
{
$container = $this->createContainerFromFile('form_no_csrf');
diff --git a/src/Symfony/Component/Console/Input/ArgvInput.php b/src/Symfony/Component/Console/Input/ArgvInput.php
index e294d25a0e..a532e954cd 100644
--- a/src/Symfony/Component/Console/Input/ArgvInput.php
+++ b/src/Symfony/Component/Console/Input/ArgvInput.php
@@ -286,6 +286,8 @@ class ArgvInput extends Input
}
if (0 === strpos($token, '-') && 0 !== strpos($token, '--')) {
+ $noValue = explode('=', $token);
+ $token = $noValue[0];
$searchableToken = str_replace('-', '', $token);
$searchableValue = str_replace('-', '', $value);
if ('' !== $searchableToken && '' !== $searchableValue && false !== strpos($searchableToken, $searchableValue)) {
diff --git a/src/Symfony/Component/Console/Tests/Input/ArgvInputTest.php b/src/Symfony/Component/Console/Tests/Input/ArgvInputTest.php
index 85fb533715..8ded178bbe 100644
--- a/src/Symfony/Component/Console/Tests/Input/ArgvInputTest.php
+++ b/src/Symfony/Component/Console/Tests/Input/ArgvInputTest.php
@@ -299,6 +299,9 @@ class ArgvInputTest extends TestCase
$input = new ArgvInput(array('cli.php', '-fh'));
$this->assertTrue($input->hasParameterOption('-fh'), '->hasParameterOption() returns true if the given short option is in the raw input');
+ $input = new ArgvInput(array('cli.php', '-e=test'));
+ $this->assertFalse($input->hasParameterOption('-s'), '->hasParameterOption() returns true if the given short option is in the raw input');
+
$input = new ArgvInput(array('cli.php', '--foo', 'foo'));
$this->assertTrue($input->hasParameterOption('--foo'), '->hasParameterOption() returns true if the given short option is in the raw input');
diff --git a/src/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php b/src/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php
index 48187c0e3f..016021e259 100644
--- a/src/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php
+++ b/src/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php
@@ -96,10 +96,10 @@ EOF;
$code = rtrim($this->compileRoutes($this->getRoutes(), $supportsRedirections), "\n");
return <<context;
\$request = \$this->request;
@@ -284,7 +284,7 @@ EOF;
if ($hasTrailingSlash) {
$code .= <<redirect(\$pathinfo.'/', '$name');
+ return \$this->redirect(\$rawPathinfo.'/', '$name');
}
@@ -299,7 +299,7 @@ EOF;
$code .= <<context->getScheme()])) {
- return \$this->redirect(\$pathinfo, '$name', key(\$requiredSchemes));
+ return \$this->redirect(\$rawPathinfo, '$name', key(\$requiredSchemes));
}
diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.php b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.php
index 8ab42890aa..6451192d18 100644
--- a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.php
+++ b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.php
@@ -15,10 +15,10 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
$this->context = $context;
}
- public function match($pathinfo)
+ public function match($rawPathinfo)
{
$allow = array();
- $pathinfo = rawurldecode($pathinfo);
+ $pathinfo = rawurldecode($rawPathinfo);
$context = $this->context;
$request = $this->request;
diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher2.php b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher2.php
index 0f4b33b3c1..9b44eb920d 100644
--- a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher2.php
+++ b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher2.php
@@ -15,10 +15,10 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
$this->context = $context;
}
- public function match($pathinfo)
+ public function match($rawPathinfo)
{
$allow = array();
- $pathinfo = rawurldecode($pathinfo);
+ $pathinfo = rawurldecode($rawPathinfo);
$context = $this->context;
$request = $this->request;
@@ -67,7 +67,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
// baz3
if ('/test/baz3' === rtrim($pathinfo, '/')) {
if (substr($pathinfo, -1) !== '/') {
- return $this->redirect($pathinfo.'/', 'baz3');
+ return $this->redirect($rawPathinfo.'/', 'baz3');
}
return array('_route' => 'baz3');
@@ -78,7 +78,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
// baz4
if (preg_match('#^/test/(?P[^/]++)/?$#s', $pathinfo, $matches)) {
if (substr($pathinfo, -1) !== '/') {
- return $this->redirect($pathinfo.'/', 'baz4');
+ return $this->redirect($rawPathinfo.'/', 'baz4');
}
return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz4')), array ());
@@ -171,7 +171,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
// hey
if ('/multi/hey' === rtrim($pathinfo, '/')) {
if (substr($pathinfo, -1) !== '/') {
- return $this->redirect($pathinfo.'/', 'hey');
+ return $this->redirect($rawPathinfo.'/', 'hey');
}
return array('_route' => 'hey');
@@ -318,7 +318,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
if ('/secure' === $pathinfo) {
$requiredSchemes = array ( 'https' => 0,);
if (!isset($requiredSchemes[$this->context->getScheme()])) {
- return $this->redirect($pathinfo, 'secure', key($requiredSchemes));
+ return $this->redirect($rawPathinfo, 'secure', key($requiredSchemes));
}
return array('_route' => 'secure');
@@ -328,7 +328,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
if ('/nonsecure' === $pathinfo) {
$requiredSchemes = array ( 'http' => 0,);
if (!isset($requiredSchemes[$this->context->getScheme()])) {
- return $this->redirect($pathinfo, 'nonsecure', key($requiredSchemes));
+ return $this->redirect($rawPathinfo, 'nonsecure', key($requiredSchemes));
}
return array('_route' => 'nonsecure');
diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher3.php b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher3.php
index 031b366b6c..04043273df 100644
--- a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher3.php
+++ b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher3.php
@@ -15,10 +15,10 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
$this->context = $context;
}
- public function match($pathinfo)
+ public function match($rawPathinfo)
{
$allow = array();
- $pathinfo = rawurldecode($pathinfo);
+ $pathinfo = rawurldecode($rawPathinfo);
$context = $this->context;
$request = $this->request;
diff --git a/src/Symfony/Component/Routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php b/src/Symfony/Component/Routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php
index cb3a144165..da90bc4fdf 100644
--- a/src/Symfony/Component/Routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php
+++ b/src/Symfony/Component/Routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php
@@ -13,11 +13,39 @@ namespace Symfony\Component\Routing\Tests\Matcher\Dumper;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Routing\Matcher\Dumper\PhpMatcherDumper;
+use Symfony\Component\Routing\Matcher\RedirectableUrlMatcherInterface;
+use Symfony\Component\Routing\Matcher\UrlMatcher;
+use Symfony\Component\Routing\RequestContext;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
class PhpMatcherDumperTest extends TestCase
{
+ /**
+ * @var string
+ */
+ private $matcherClass;
+
+ /**
+ * @var string
+ */
+ private $dumpPath;
+
+ protected function setUp()
+ {
+ parent::setUp();
+
+ $this->matcherClass = uniqid('ProjectUrlMatcher');
+ $this->dumpPath = sys_get_temp_dir().DIRECTORY_SEPARATOR.'php_matcher.'.$this->matcherClass.'.php';
+ }
+
+ protected function tearDown()
+ {
+ parent::tearDown();
+
+ @unlink($this->dumpPath);
+ }
+
/**
* @expectedException \LogicException
*/
@@ -36,6 +64,23 @@ class PhpMatcherDumperTest extends TestCase
$dumper->dump();
}
+ public function testRedirectPreservesUrlEncoding()
+ {
+ $collection = new RouteCollection();
+ $collection->add('foo', new Route('/foo:bar/'));
+
+ $class = $this->generateDumpedMatcher($collection, true);
+
+ $matcher = $this->getMockBuilder($class)
+ ->setMethods(array('redirect'))
+ ->setConstructorArgs(array(new RequestContext()))
+ ->getMock();
+
+ $matcher->expects($this->once())->method('redirect')->with('/foo%3Abar/', 'foo');
+
+ $matcher->match('/foo%3Abar');
+ }
+
/**
* @dataProvider getRouteCollections
*/
@@ -285,4 +330,31 @@ class PhpMatcherDumperTest extends TestCase
array($rootprefixCollection, 'url_matcher3.php', array()),
);
}
+
+ /**
+ * @param $dumper
+ */
+ private function generateDumpedMatcher(RouteCollection $collection, $redirectableStub = false)
+ {
+ $options = array('class' => $this->matcherClass);
+
+ if ($redirectableStub) {
+ $options['base_class'] = '\Symfony\Component\Routing\Tests\Matcher\Dumper\RedirectableUrlMatcherStub';
+ }
+
+ $dumper = new PhpMatcherDumper($collection);
+ $code = $dumper->dump($options);
+
+ file_put_contents($this->dumpPath, $code);
+ include $this->dumpPath;
+
+ return $this->matcherClass;
+ }
+}
+
+abstract class RedirectableUrlMatcherStub extends UrlMatcher implements RedirectableUrlMatcherInterface
+{
+ public function redirect($path, $route, $scheme = null)
+ {
+ }
}
diff --git a/src/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php b/src/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php
index ba4c6e972f..0b5bb0dc78 100644
--- a/src/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php
+++ b/src/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php
@@ -69,4 +69,14 @@ class RedirectableUrlMatcherTest extends TestCase
;
$matcher->match('/foo');
}
+
+ public function testRedirectPreservesUrlEncoding()
+ {
+ $coll = new RouteCollection();
+ $coll->add('foo', new Route('/foo:bar/'));
+
+ $matcher = $this->getMockForAbstractClass('Symfony\Component\Routing\Matcher\RedirectableUrlMatcher', array($coll, new RequestContext()));
+ $matcher->expects($this->once())->method('redirect')->with('/foo%3Abar/');
+ $matcher->match('/foo%3Abar');
+ }
}