Skip to content

Commit

Permalink
feature #22880 [Routing] remove deprecated features (xabbuh)
Browse files Browse the repository at this point in the history
This PR was merged into the 4.0-dev branch.

Discussion
----------

[Routing] remove deprecated features

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | yes
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

Commits
-------

9560031 [Routing] remove deprecated features
  • Loading branch information
fabpot committed May 25, 2017
2 parents 4c7da9f + 9560031 commit ad2c9f0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
6 changes: 6 additions & 0 deletions src/Symfony/Component/Routing/CHANGELOG.md
@@ -1,6 +1,12 @@
CHANGELOG
=========

4.0.0
-----

* dropped support for using UTF-8 route patterns without using the `utf8` option
* dropped support for using UTF-8 route requirements without using the `utf8` option

3.3.0
-----

Expand Down
6 changes: 2 additions & 4 deletions src/Symfony/Component/Routing/RouteCompiler.php
Expand Up @@ -103,8 +103,7 @@ private static function compilePattern(Route $route, $pattern, $isHost)
$needsUtf8 = $route->getOption('utf8');

if (!$needsUtf8 && $useUtf8 && preg_match('/[\x80-\xFF]/', $pattern)) {
$needsUtf8 = true;
@trigger_error(sprintf('Using UTF-8 route patterns without setting the "utf8" option is deprecated since Symfony 3.2 and will throw a LogicException in 4.0. Turn on the "utf8" route option for pattern "%s".', $pattern), E_USER_DEPRECATED);
throw new \LogicException(sprintf('Cannot use UTF-8 route patterns without setting the "utf8" option for route "%s".', $route->getPath()));
}
if (!$useUtf8 && $needsUtf8) {
throw new \LogicException(sprintf('Cannot mix UTF-8 requirements with non-UTF-8 pattern "%s".', $pattern));
Expand Down Expand Up @@ -176,8 +175,7 @@ private static function compilePattern(Route $route, $pattern, $isHost)
if (!preg_match('//u', $regexp)) {
$useUtf8 = false;
} elseif (!$needsUtf8 && preg_match('/[\x80-\xFF]|(?<!\\\\)\\\\(?:\\\\\\\\)*+(?-i:X|[pP][\{CLMNPSZ]|x\{[A-Fa-f0-9]{3})/', $regexp)) {
$needsUtf8 = true;
@trigger_error(sprintf('Using UTF-8 route requirements without setting the "utf8" option is deprecated since Symfony 3.2 and will throw a LogicException in 4.0. Turn on the "utf8" route option for variable "%s" in pattern "%s".', $varName, $pattern), E_USER_DEPRECATED);
throw new \LogicException(sprintf('Cannot use UTF-8 route requirements without setting the "utf8" option for variable "%s" in pattern "%s".', $varName, $pattern));
}
if (!$useUtf8 && $needsUtf8) {
throw new \LogicException(sprintf('Cannot mix UTF-8 requirement with non-UTF-8 charset for variable "%s" in pattern "%s".', $varName, $pattern));
Expand Down
3 changes: 1 addition & 2 deletions src/Symfony/Component/Routing/Tests/RouteCompilerTest.php
Expand Up @@ -184,9 +184,8 @@ public function provideCompileData()
}

/**
* @group legacy
* @dataProvider provideCompileImplicitUtf8Data
* @expectedDeprecation Using UTF-8 route %s without setting the "utf8" option is deprecated %s.
* @expectedException \LogicException
*/
public function testCompileImplicitUtf8Data($name, $arguments, $prefix, $regex, $variables, $tokens, $deprecationType)
{
Expand Down

0 comments on commit ad2c9f0

Please sign in to comment.