Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5d212ce

Browse filesBrowse files
author
mwsaz
committed
[Routing] added '-' as a default separator
1 parent fd43810 commit 5d212ce
Copy full SHA for 5d212ce

File tree

7 files changed

+13
-13
lines changed
Filter options

7 files changed

+13
-13
lines changed

‎src/Symfony/Component/Routing/Matcher/Dumper/ApacheMatcherDumper.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Routing/Matcher/Dumper/ApacheMatcherDumper.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,6 @@ public function dump(array $options = array())
7070
$regexes[] = sprintf("%sRewriteCond %%{PATH_INFO} %s\nRewriteRule .* %s [QSA,L,%s]", $conditions, $regex, $options['script_name'], $variables);
7171
}
7272

73-
return implode("\n\n", $regexes);
73+
return implode("\n\n", $regexes)."\n";
7474
}
7575
}

‎src/Symfony/Component/Routing/Route.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Routing/Route.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public function getOptions()
101101
public function setOptions(array $options)
102102
{
103103
$this->options = array_merge(array(
104-
'segment_separators' => array('/', '.'),
104+
'segment_separators' => array('/', '.', '-'),
105105
'text_regex' => '.+?',
106106
'compiler_class' => 'Symfony\\Component\\Routing\\RouteCompiler',
107107
), $options);

‎tests/Symfony/Tests/Component/Routing/CompiledRouteTest.php

Copy file name to clipboardExpand all lines: tests/Symfony/Tests/Component/Routing/CompiledRouteTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function testgetPatterngetDefaultsgetOptionsgetRequirements()
3737
$this->assertEquals(array('foo' => 'bar'), $compiled->getDefaults(), '->getDefaults() returns the route defaults');
3838
$this->assertEquals(array('foo' => '\d+'), $compiled->getRequirements(), '->getRequirements() returns the route requirements');
3939
$this->assertEquals(array_merge(array(
40-
'segment_separators' => array('/', '.'),
40+
'segment_separators' => array('/', '.', '-'),
4141
'text_regex' => '.+?',
4242
'compiler_class' => 'Symfony\\Component\\Routing\\RouteCompiler',
4343
), array('foo' => 'bar')), $compiled->getOptions(), '->getOptions() returns the route options');

‎tests/Symfony/Tests/Component/Routing/Fixtures/dumper/url_matcher1.apache

Copy file name to clipboardExpand all lines: tests/Symfony/Tests/Component/Routing/Fixtures/dumper/url_matcher1.apache
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ RewriteCond %{PATH_INFO} ^/foo/(baz|symfony)$
22
RewriteRule .* app.php [QSA,L,E=_ROUTING__route:foo,E=_ROUTING_bar:%1,E=_ROUTING_def:test]
33

44
RewriteCond %{REQUEST_METHOD} ^(GET|head) [NC]
5-
RewriteCond %{PATH_INFO} ^/bar/([^/\.]+?)$
6-
RewriteRule .* app.php [QSA,L,E=_ROUTING__route:bar,E=_ROUTING_foo:%1]
5+
RewriteCond %{PATH_INFO} ^/bar/([^/\.\-]+?)$
6+
RewriteRule .* app.php [QSA,L,E=_ROUTING__route:bar,E=_ROUTING_foo:%1]

‎tests/Symfony/Tests/Component/Routing/Fixtures/dumper/url_matcher1.php

Copy file name to clipboardExpand all lines: tests/Symfony/Tests/Component/Routing/Fixtures/dumper/url_matcher1.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function match($url)
2525
return array_merge($this->mergeDefaults($matches, array ( 'def' => 'test',)), array('_route' => 'foo'));
2626
}
2727

28-
if (isset($this->context['method']) && preg_match('#^(GET|head)$#xi', $this->context['method']) && 0 === strpos($url, '/bar') && preg_match('#^/bar/(?P<foo>[^/\.]+?)$#x', $url, $matches)) {
28+
if (isset($this->context['method']) && preg_match('#^(GET|head)$#xi', $this->context['method']) && 0 === strpos($url, '/bar') && preg_match('#^/bar/(?P<foo>[^/\.\-]+?)$#x', $url, $matches)) {
2929
return array_merge($this->mergeDefaults($matches, array ()), array('_route' => 'bar'));
3030
}
3131

‎tests/Symfony/Tests/Component/Routing/RouteCompilerTest.php

Copy file name to clipboardExpand all lines: tests/Symfony/Tests/Component/Routing/RouteCompilerTest.php
+6-6Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,23 +45,23 @@ public function provideCompileData()
4545
array(
4646
'Route with a variable',
4747
array('/foo/{bar}'),
48-
'/foo', '#^/foo/(?P<bar>[^/\.]+?)$#x', array('bar' => '{bar}'), array(
48+
'/foo', '#^/foo/(?P<bar>[^/\.\-]+?)$#x', array('bar' => '{bar}'), array(
4949
array('variable', '/', '{bar}', 'bar'),
5050
array('text', '/', 'foo', null),
5151
)),
5252

5353
array(
5454
'Route with a variable that has a default value',
5555
array('/foo/{bar}', array('bar' => 'bar')),
56-
'/foo', '#^/foo(?:/(?P<bar>[^/\.]+?))?$#x', array('bar' => '{bar}'), array(
56+
'/foo', '#^/foo(?:/(?P<bar>[^/\.\-]+?))?$#x', array('bar' => '{bar}'), array(
5757
array('variable', '/', '{bar}', 'bar'),
5858
array('text', '/', 'foo', null),
5959
)),
6060

6161
array(
6262
'Route with several variables',
6363
array('/foo/{bar}/{foobar}'),
64-
'/foo', '#^/foo/(?P<bar>[^/\.]+?)/(?P<foobar>[^/\.]+?)$#x', array('bar' => '{bar}', 'foobar' => '{foobar}'), array(
64+
'/foo', '#^/foo/(?P<bar>[^/\.\-]+?)/(?P<foobar>[^/\.\-]+?)$#x', array('bar' => '{bar}', 'foobar' => '{foobar}'), array(
6565
array('variable', '/', '{foobar}', 'foobar'),
6666
array('variable', '/', '{bar}', 'bar'),
6767
array('text', '/', 'foo', null),
@@ -70,7 +70,7 @@ public function provideCompileData()
7070
array(
7171
'Route with several variables that have default values',
7272
array('/foo/{bar}/{foobar}', array('bar' => 'bar', 'foobar' => 'foobar')),
73-
'/foo', '#^/foo(?:/(?P<bar>[^/\.]+?) (?:/(?P<foobar>[^/\.]+?) )?)?$#x', array('bar' => '{bar}', 'foobar' => '{foobar}'), array(
73+
'/foo', '#^/foo(?:/(?P<bar>[^/\.\-]+?) (?:/(?P<foobar>[^/\.\-]+?) )?)?$#x', array('bar' => '{bar}', 'foobar' => '{foobar}'), array(
7474
array('variable', '/', '{foobar}', 'foobar'),
7575
array('variable', '/', '{bar}', 'bar'),
7676
array('text', '/', 'foo', null),
@@ -79,7 +79,7 @@ public function provideCompileData()
7979
array(
8080
'Route with several variables but some of them have no default values',
8181
array('/foo/{bar}/{foobar}', array('bar' => 'bar')),
82-
'/foo', '#^/foo/(?P<bar>[^/\.]+?)/(?P<foobar>[^/\.]+?)$#x', array('bar' => '{bar}', 'foobar' => '{foobar}'), array(
82+
'/foo', '#^/foo/(?P<bar>[^/\.\-]+?)/(?P<foobar>[^/\.\-]+?)$#x', array('bar' => '{bar}', 'foobar' => '{foobar}'), array(
8383
array('variable', '/', '{foobar}', 'foobar'),
8484
array('variable', '/', '{bar}', 'bar'),
8585
array('text', '/', 'foo', null),
@@ -88,7 +88,7 @@ public function provideCompileData()
8888
array(
8989
'Route with a custom token',
9090
array('/=foo', array(), array(), array('compiler_class' => 'Symfony\\Tests\\Component\\Routing\\RouteCompiler')),
91-
'', '#^/foo/(?P<foo>[^/\.]+?)$#x', array('foo' => '=foo'), array(
91+
'', '#^/foo/(?P<foo>[^/\.\-]+?)$#x', array('foo' => '=foo'), array(
9292
array('label', '/', '=foo', 'foo'),
9393
)),
9494
);

‎tests/Symfony/Tests/Component/Routing/RouteTest.php

Copy file name to clipboardExpand all lines: tests/Symfony/Tests/Component/Routing/RouteTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function testOptions()
4141
$route = new Route('/{foo}');
4242
$route->setOptions(array('foo' => 'bar'));
4343
$this->assertEquals(array_merge(array(
44-
'segment_separators' => array('/', '.'),
44+
'segment_separators' => array('/', '.', '-'),
4545
'text_regex' => '.+?',
4646
'compiler_class' => 'Symfony\\Component\\Routing\\RouteCompiler',
4747
), array('foo' => 'bar')), $route->getOptions(), '->setOptions() sets the options');

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.