In porting some Yii1 code to Yii2 things are going pretty well, but I ran into an issue with a simple URL Rule Class something like this -
class ReviewsUrlRule extends Object implements UrlRuleInterface
{
...
public function parseRequest($manager, $request)
{
//
// This will match things like
// /reviews
// /reviews/ford
// /reviews/mustang
// /reviews/ford/mustang/1235
// etc...
//
// Note the Make and Model has only a 1 or 2 word scan
// Special chars are handled as part of the character set (think Citroen, Up!, etc)
//
// Might be a better way to do this but that is left as an exercise for the reader...
$pathInfo = $request->getPathInfo();
var_dump($pathInfo);
exit(1);
}
}
When I take a look at $pathInfo I see a trailing ‘/’. In the docs I see this comment -
I can easily strip the trailing slash in my handler, but want to make sure that either it’s a problem with the yii\web\Request::getPathInfo() or I’m not overlooking something that I should care about. The trailing slash breaks the current (ugly) regex for my url structure.
Sandy