diff options
author | Ivan Enderlin <ivan.enderlin@hoa-project.net> | 2015-07-30 16:46:01 +0200 |
---|---|---|
committer | Ivan Enderlin <ivan.enderlin@hoa-project.net> | 2015-07-30 16:46:01 +0200 |
commit | 01c337932120f75877696246d18c24527f197ad2 (patch) | |
tree | 40a7ead7b8deb23609819030811cacf6792167ea /Http | |
parent | be0736b5f2e198e7dce32e60eb0e1dee2de180d5 (diff) | |
download | Router-01c337932120f75877696246d18c24527f197ad2.zip Router-01c337932120f75877696246d18c24527f197ad2.tar.gz Router-01c337932120f75877696246d18c24527f197ad2.tar.bz2 |
Filter protected variables when unrouting.
Previous commit transformed unused variables as query strings when
unrouting. However, the `unroute` method also receives protected
variables (such as `_domain`, `_query` and also `_this` for the kit in
case of a dispatcher etc.).
This commit filters unused variables to remove protected variables.
Diffstat (limited to 'Http')
-rw-r--r-- | Http/Http.php | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Http/Http.php b/Http/Http.php index 97c4803..903289f 100644 --- a/Http/Http.php +++ b/Http/Http.php @@ -621,7 +621,13 @@ class Http extends Router\Generic implements Core\Parameter\Parameterizable Array $variables, $allowEmpty = true ) { - $unusedVariables = $variables; + $unusedVariables = []; + + foreach ($variables as $key => $variable) { + if ('_' !== $key[0]) { + $unusedVariables[$key] = $variable; + } + } // (?<named>…) $out = preg_replace_callback( |