-
-
Notifications
You must be signed in to change notification settings - Fork 246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Broken subroute pattern #172
Comments
Please do not send JavaScript files via the router! Configure a public folder on your server where you can store static files. If the request fails or the index file gets executed specifically, execute the router 🙂
|
@uvulpos the |
Normally you do not generate Javascript via PHP and even if you would because you create a Javascript generator website, than it would be possible to name it just something e.x. /download and change the output name by PHP header to e.x. something.js. PHPSpreadsheet does this for example if you want to stream your output. Example: Anyway, if this is such a big deal for you, I can try to fix that by pull request but feel free to do it youself and reference this issue by commit ;) |
@latdev you've probably thought of this already but anyway: as a workaround you can use |
@uvulpos The issue is not related directly to JS though, is it? It's about that // Check if server base path is defined, if not define it.
if ($this->serverBasePath === null) {
$this->serverBasePath = implode('/', array_slice(explode('/', $_SERVER['SCRIPT_NAME']), 0, -1)) . '/';
} BTW Have you considered using /**
* @Revs(8000)
* @Iterations(5)
*/
class benchmark_dirname
{
public $uri = '/bramus/router/issues/172';
function benchDirname()
{
$basePath = dirname($this->uri) . '/';
}
function benchImplodeSlideExplode()
{
$basePath = implode('/', array_slice(explode('/', $this->uri), 0, -1)) . '/';
}
} The
|
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
Pattern fails with $uri.
The text was updated successfully, but these errors were encountered: