bramus / bramus/router

Broken subroute pattern

Open
#172 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
1.1k
Forks
236
PR merge metrics
No merged PRs in 30d

Description

Looks like getBasePath bug.

With router definition.
`$router->get("/backend/io\.js", 'IoController@actionIndex');`

Inside Router.class
`private function patternMatches($pattern, $uri, &$matches, $flags)`

After executing with
```
var_dump($uri);
// we may have a match!
return boolval(preg_match_all('#^' . $pattern . '$#', $uri, $matches, PREG_OFFSET_CAPTURE));
```
Pattern fails with $uri.
```
string(15) "io.js"
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in Router.class at patternMatches($pattern, $uri, &$matches, $flags), using the reported route `/backend/io\.js` and URI `io.js` as the reproduction. Trace how getBasePath and the subroute pattern are built, then add or update a test for this route. Done means the escaped-dot route matches the shown URI correctly without breaking other route patterns.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.