Edit: Actually it seems the first value is being used, not the one being injected at the 0 index.
Which is getting the route and using it as a query parameter with no value when passing it to the ‘urlManager->createUrl’ method.
Something else I noticed, when using a forward slash in front of the URL for the route property of the Sort object it doesn’t resolve it to an absolute URL. The Sort object’s createUrl takes two arguements, the second being an optional absolute argument. However, when calling the Sort::link method it only passes the sort attribute. So a route could never be absolute.
I was wondering if it was the URL manager after I added pagination and noticed that it was doing the same thing.
For that route, I do not have a special route for it — to check to see if routing was an issue at all I commented out all routes and it still yielded the same results.
Yep. It seems to be an issue when using pretty URLs. I turned it off and the URL manager generated the URL with the route parameter set to the route without having the route as its own parameter with no value.
I think that there are 2 possible causes for this issue.
There might be a rule that you have overlooked which will match the route and the parameters for the links for sort and/or pagination. When it is defined prior to the one that you intend to apply to the links, then something strange may happen.
I would check all the rules one by one, from top to bottom, whether it can unintentionally match the route and the parameters for the links for sort and/or pagination.
There might be a bug in the url manager of the framework.
I said above with the other one that doesn’t have a special rule, it follows the normal module/controller/action structure and I also commented out all of my rules when testing the first one and it yielded the same results. So I think the issue lies with the URL manager.
Here are my routes, but I’m confident that they’re not causing the issue.
I just… I can’t man… So, I was about to submit the issue on Github and was looking through everything, I noticed something and decided to check one more thing.
It was the .htaccess rewrite rule causing
RewriteRule ^(.*)$ index.php?$1 [QSA,L]
Specifically the ?$1 That was a config carried over and since the rest of the site was working fine up to adding Pagination and Sort it went completely unnoticed.
[s]That said, resolving the previous issue with the path as a query string, there’s still something I see as a bug. Having a custom route, where there’s a slug that gets passed as an argument to the action, the URL manager appends that to the URL.