encode and decode parameters in routes
All checks were successful
soko-web/pipeline/head This commit looks good
All checks were successful
soko-web/pipeline/head This commit looks good
This commit is contained in:
parent
5534f10cee
commit
d504f1d5bb
@ -34,7 +34,7 @@ class Route implements IRoute
|
||||
foreach ($this->pattern as $fragment) {
|
||||
if (preg_match('/^{(\\w+)(\\?)?}$/', $fragment, $matches) === 1) {
|
||||
if (isset($parameters[$matches[1]])) {
|
||||
$link[] = $parameters[$matches[1]];
|
||||
$link[] = rawurlencode($parameters[$matches[1]]);
|
||||
unset($parameters[$matches[1]]);
|
||||
} elseif (!isset($matches[2])) {//TODO: why? parameter not found but not optional
|
||||
$link[] = $fragment;
|
||||
@ -64,7 +64,7 @@ class Route implements IRoute
|
||||
|
||||
foreach ($path as $i => $fragment) {
|
||||
if (preg_match('/^{(\\w+)(?:\\?)?}$/', $this->pattern[$i], $matches) === 1) {
|
||||
$parameters[$matches[1]] = $fragment;
|
||||
$parameters[$matches[1]] = rawurldecode($fragment);
|
||||
} elseif ($fragment != $this->pattern[$i]) {
|
||||
return null;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user