Skip to content
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

fix: spark routes shows "ERROR: 404" #6098

Merged
merged 1 commit into from
Jun 12, 2022

Conversation

kenjis
Copy link
Member

@kenjis kenjis commented Jun 8, 2022

Description
Whe you enable Auto Route Improved,
By adding the method Home::getTest, the command php spark routes gives the result:

ERROR: 404
Cannot access the default controller "Home" with the controller name URI path.

Reported in #6097

How to Test

diff --git a/app/Config/Feature.php b/app/Config/Feature.php
index 4c5ec90cd..480697b61 100644
--- a/app/Config/Feature.php
+++ b/app/Config/Feature.php
@@ -28,5 +28,5 @@ class Feature extends BaseConfig
     /**
      * Use improved new auto routing instead of the default legacy version.
      */
-    public bool $autoRoutesImproved = false;
+    public bool $autoRoutesImproved = true;
 }
diff --git a/app/Config/Routes.php b/app/Config/Routes.php
index ff2ac645c..78a76bc5c 100644
--- a/app/Config/Routes.php
+++ b/app/Config/Routes.php
@@ -25,7 +25,7 @@ $routes->set404Override();
 // where controller filters or CSRF protection are bypassed.
 // If you don't want to define all routes, please use the Auto Routing (Improved).
 // Set `$autoRoutesImproved` to true in `app/Config/Feature.php` and set the following to true.
-//$routes->setAutoRoute(false);
+$routes->setAutoRoute(true);
 
 /*
  * --------------------------------------------------------------------
diff --git a/app/Controllers/Home.php b/app/Controllers/Home.php
index 7f867e95f..3d34582e1 100644
--- a/app/Controllers/Home.php
+++ b/app/Controllers/Home.php
@@ -8,4 +8,8 @@ class Home extends BaseController
     {
         return view('welcome_message');
     }
+
+    public function getTest()
+    {
+    }
 }

and run php spark routes.

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

By adding the method Home::getTest, the command php spark routes gives the result:
  ERROR: 404
  Cannot access the default controller "Home" with the controller name URI path.
@kenjis kenjis added the bug Verified issues on the current code behavior or pull requests that will fix them label Jun 8, 2022
@kenjis kenjis changed the title fix: spark routes shows "ERROR: 404" fix: spark routes shows "ERROR: 404" Jun 8, 2022
@kenjis kenjis merged commit 6bdbe10 into codeigniter4:develop Jun 12, 2022
@kenjis kenjis deleted the fix-spark-routes-bug branch June 12, 2022 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Verified issues on the current code behavior or pull requests that will fix them
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants