Skip to content

Commit

Permalink
Yaf_Route_Rewrite now process multiple repeated bach slashes as one
Browse files Browse the repository at this point in the history
URI: /aaa////bbb/c -> /a/bbb/c
  • Loading branch information
laruence committed Mar 14, 2020
1 parent 618c80b commit 4523067
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions routes/yaf_route_rewrite.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ static int yaf_route_rewrite_match(yaf_route_t *router, const zend_string *uri,
}
if (pos) {
smart_str_appendc(&pattern, YAF_ROUTER_URL_DELIMIETER);
smart_str_appendc(&pattern, '+');
m = ++pos;
l--;
}
Expand Down
3 changes: 3 additions & 0 deletions tests/088.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ yaf.use_namespace=0
$url = array(
"/", "/foo", "//foo/", "/foo/bar", "/foo///",
"/foo/cont/act", "/foo/cont/act/", "/foocont/act",
"/foo/cont//act", "/foo//cont///act//",
"/foo/cont/act//var/value/", "/foo/cont/act//var/value/age",
"/foo/cont/act//var/value/age/12//",
);
Expand Down Expand Up @@ -43,6 +44,8 @@ foreach ($url as $u) {
/foo/cont/act : m=> c=> a=>
/foo/cont/act/ : m=> c=>cont a=>act args=>name->cont,subname->act,
/foocont/act : m=> c=> a=>
/foo/cont//act : m=> c=> a=>
/foo//cont///act// : m=> c=>cont a=>act args=>name->cont,subname->act,
/foo/cont/act//var/value/ : m=> c=>cont a=>act args=>name->cont,subname->act,var->value,
/foo/cont/act//var/value/age : m=> c=>cont a=>act args=>name->cont,subname->act,var->value,age->,
/foo/cont/act//var/value/age/12// : m=> c=>cont a=>act args=>name->cont,subname->act,var->value,age->12,

0 comments on commit 4523067

Please sign in to comment.