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: exception message might display in production #6326

Closed
kenjis opened this issue Aug 1, 2022 · 0 comments · Fixed by #6333
Closed

Bug: exception message might display in production #6326

kenjis opened this issue Aug 1, 2022 · 0 comments · Fixed by #6333
Assignees
Labels
bug Verified issues on the current code behavior or pull requests that will fix them

Comments

@kenjis
Copy link
Member

kenjis commented Aug 1, 2022

This is PoC to show the current PageNotFoundException handling is not good.

.env:

CI_ENVIRONMENT = production
--- a/app/Config/Events.php
+++ b/app/Config/Events.php
@@ -4,6 +4,7 @@ namespace Config;
 
 use CodeIgniter\Events\Events;
 use CodeIgniter\Exceptions\FrameworkException;
+use CodeIgniter\Exceptions\PageNotFoundException;
 
 /*
  * --------------------------------------------------------------------
@@ -46,3 +47,7 @@ Events::on('pre_system', static function () {
         Services::toolbar()->respond();
     }
 });
+
+Events::on('pre_system', static function () {
+    throw new PageNotFoundException('this is raw exception message.');
+});

Navigate to http://localhost:8080/ and you will see:

404 - File Not Found
this is raw exception message.
@kenjis kenjis added the bug Verified issues on the current code behavior or pull requests that will fix them label Aug 1, 2022
@kenjis kenjis self-assigned this Aug 2, 2022
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.

1 participant