aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Enderlin <ivan.enderlin@hoa-project.net>2015-07-30 16:46:01 +0200
committerIvan Enderlin <ivan.enderlin@hoa-project.net>2015-07-30 16:46:01 +0200
commit01c337932120f75877696246d18c24527f197ad2 (patch)
tree40a7ead7b8deb23609819030811cacf6792167ea
parentbe0736b5f2e198e7dce32e60eb0e1dee2de180d5 (diff)
downloadRouter-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.
-rw-r--r--Http/Http.php8
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(