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

Bug: Fatal error: Cannot declare class CodeIgniter\Exceptions\PageNotFoundException #3067

Closed
enix-app opened this issue Jun 5, 2020 · 6 comments · Fixed by #3076
Closed
Labels
bug Verified issues on the current code behavior or pull requests that will fix them

Comments

@enix-app
Copy link
Contributor

enix-app commented Jun 5, 2020

Describe the bug

This is not intentional,

I added route:

$routes->get('/test/(:num)', 'Home::index');

I tried in bar url:

http://localhost:8080/test/([0-9]+)

http://localhost:8080//

http://localhost:8080/test/abc

Show me an error:

Fatal error: Cannot declare class CodeIgniter\Exceptions\PageNotFoundException, because the name is already in use in D:\codeigniter4\CodeIgniter4-test\system\Exceptions\PageNotFoundException.php on line 3

Fatal error: Cannot declare class CodeIgniter\Exceptions\PageNotFoundException, because the name is already in use in D:\codeigniter4\CodeIgniter4-test\system\Exceptions\PageNotFoundException.php on line 3

CodeIgniter 4 version
development, last commit #3062 , fresh install

Affected module(s)
Exception class, Router class

Context

  • Environment: development
  • OS: Win10
  • Built-in PHP Web server, Apache2.4
  • PHP 7.3
@enix-app enix-app added the bug Verified issues on the current code behavior or pull requests that will fix them label Jun 5, 2020
@enix-app enix-app closed this as completed Jun 6, 2020
@enix-app enix-app reopened this Jun 6, 2020
@samsonasik
Copy link
Member

samsonasik commented Jun 8, 2020

@enix-app Yes, it seems a new bug in develop branch . @lonnieezell @MGatner could you looking at it? Probably caused after autoload PR #3052 /cc @mostafakhudair

@MGatner
Copy link
Member

MGatner commented Jun 8, 2020

I haven't noticed it but I will see if I can reproduce tomorrow when I update a project with that new Autoload.

@MGatner
Copy link
Member

MGatner commented Jun 9, 2020

UPDATE: I've been able to replicate this. Still not sure as to the root cause.

@MGatner
Copy link
Member

MGatner commented Jun 9, 2020

The bug was introduced with #2958. Actual underlying issue TBD

@MGatner
Copy link
Member

MGatner commented Jun 9, 2020

system/Debug/Exceptions.php, Line 308:

include $file;

@MGatner
Copy link
Member

MGatner commented Jun 9, 2020

The problem is actually a collision with $file caused by extract($vars);. Fix incoming.

MGatner added a commit to MGatner/CodeIgniter4 that referenced this issue Jun 9, 2020

Verified

This commit was signed with the committer’s verified signature.
MGatner MGatner
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 a pull request may close this issue.

3 participants