Probably a bug in slim/twig-view

I am developing a skeleton for myself and here I am using slim/twig-view.
I am running the application in a sub-directory (htdocs\iRaziul\Slim4) and using selective/basepath to detect and set application basepath as Slim 4 requires it.
The issue I have found is that whenever I use current_url it returns a strange output.


here I got the basepath twice.
I have found that at TwigRuntimeExtension.php on line 81

$currentUrl = $this->basePath . $this->uri->getPath();

getPath method from URI also returns the full path including the basepath so it is obvious to get the basepath twice in the final output of current_url.

Although I can solve it by it will not solve the problem for others.


I’m the author of selective/basepath.
Can you show us what you get when you call this?

echo $app->getBasePath();

You may also try to use this diagnostic script and show us the results.

If I call it before run() then nothing appears as the basepath get sets via middleware, but calling it after running the application returns me the sub-directory of the application which is correct.

I can assure you that the problem belongs to the slim/twig-view package.