Your browser (Internet Explorer 6) is out of date. It has known security flaws and may not display all features of this and other websites. Learn how to update your browser.
X

[Solved] Altorouter not matching forward slash

I was currently modifying the GoCart for some client projects and I realised that the routing used for the modified CodeIgniter eCommerce application does not seems to match the route for /path and /path/ to the controller.

This is really disturbing because it is not possible to start changing all the routes to match exactly what the URL is especially when the routes are generated dynamically.

After doing some research I realised that the issue is with pregmatch and from all I read, they are not ready to include this fix in their component because they feel you have to strictly match your route.

However, I have been able to make below necessaru change...it works. Go to your vendor folder and open the file Altorouter.php and change line 256 to

$pattern = '(?:'
. ('' !== $pre ? $pre.'+' : null)
. '('
. ('' !== $param ? "?P<$param>" : null)
. $type
. ')'
. $optional
. '(/+|))'
. $optional;

You then need to becareful not to update it...Lol

 


comments powered by Disqus