-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Bug: autoRoute is not working, it is giving priority to manual routes. #9451
Comments
Can you give us a clear example of what worked in v4.5.8 and stopped in v4.6.0? What is the controller and method you're using to test this? |
like in this home controller, when I access the home it will redirect to the login controller, in version 4.6.0 I get a return saying that the login controller was not found, I use autorouter true, so it is automatic, and in this version it does not work unless I put a manual route in the routes.php file. but in version 4.5.8 this way it works with an automatic route, without needing to put a manual route in the routes.php file |
Sorry, but I cannot reproduce the problem. Here are my steps - using the // app\Config\Routes.php (no changes here but I will include it to be clear)
<?php
use CodeIgniter\Router\RouteCollection;
/**
* @var RouteCollection $routes
*/
$routes->get('/', 'Home::index'); // app\Controllers\Home.php
<?php
namespace App\Controllers;
class Home extends BaseController
{
public function index()
{
return redirect()->to('/login');
}
} // app\Controllers\Login.php
<?php
namespace App\Controllers;
class Login extends BaseController
{
public function getIndex()
{
var_dump('login::index');
}
} Entering the Can you provide more details or context? Are the steps I provided accurate and does the same problem still occur on a new installation after following them? |
Gravação de Tela 2025-02-16 103954.zip Record a video of how I do it here, the same way I did in the video works in version 4.5.8 |
Sorry, but I won't download any files from "random" people on the Internet. If you can post it somewhere where I can view it online, I will. Please follow the steps from my previous post and tell me if they are correct or if I should add something to reproduce the problem. |
This is the same way you did it, the only difference when passing a var_dump I put an echo to display any message. |
Ok, seems like you missed the information that in v4.6.0 To use auto-routes legacy, you have to set |
Okay, thank you very much, I apologize, I really hadn't seen that change, as I mentioned in the topic if there was any update that I wasn't aware of, sorry. |
No worries, I should have asked about it earlier. |
PHP Version
8.1
CodeIgniter4 Version
4.6.0
CodeIgniter4 Installation Method
Manual (zip or tar.gz)
Which operating systems have you tested for this bug?
Windows
Which server did you use?
apache
Database
No response
What happened?
I already have a working project, in version 4.5.8 with autoRoute true, and I went to update to 4.6.0 and the automatic route stopped, I noticed that it only worked in the manual route, I tried to modify it but without success.
Steps to Reproduce
Expected Output
Anything else?
It may be some new change that has happened, but I couldn't find it in the CHANGELOG.
The text was updated successfully, but these errors were encountered: