Closed juangws closed 2 months ago
Thank you for reporting!
I don't understand your recommendation. What is the Internal Server Error in "ajax"? Can you show the exact whole error message?
I create an environment file wus.php
in the Boot
directory.
And in the .env
file, CI_ENVIRONMENT
is set to wus
.
There is a problem now that "system/Debug/ExceptionHandler.php" does not work in a custom environment.
So why not, use CI_DEBUG
instead of ENVIRONMENT === 'development' || ENVIRONMENT === 'testing'
.
If there is no way to change it, I can also modify it manually. Thank you.
*I don't know much English. I use Google Translate. I hope it won't cause you any trouble. Thank you.
I think "system/Debug/ExceptionHandler.php" works.
If ENVIRONMENT
is not development
or testing
,
$data
will be ''
.
What is the exact error?
By the way, for what do you use wus
?
Because sometimes online debugging.
Customize wus.php
and use IP to determine who is development
and who is production
.
So I use wus.php
to implement dynamic environment mode and Customize maintenance mode.
If there is an error in the code itself, $data should have an error message instead of an empty value.
But in fact it is restricted by the environment name. Only environment name is development
and production
show errors.
The development.php
and production.php
code:
// development.php
defined('CI_DEBUG') || define('CI_DEBUG', true);
// production.php
defined('CI_DEBUG') || define('CI_DEBUG', false);
What is its function and purpose?
So it doesn't matter whether I customize the environment mode or not.
Why not make good use of CI_DEBUG
to differentiate?
My question is, what is the Internal Server Error in "ajax"? I don't think Internal Server Error should happen.
What is its function and purpose?
CI_DEBUG
is now used for Kint and Debug Toolbar.
https://codeigniter4.github.io/CodeIgniter4/testing/debugging.html#enabling-kint
https://codeigniter4.github.io/CodeIgniter4/testing/debugging.html#enabling-the-toolbar
If there is an error in the code itself, $data should have an error message instead of an empty value. But in fact it is restricted by the environment name. Only environment name is development and production show errors.
At least, it matches the description in the user guide.
By default, CodeIgniter will display a detailed error report with all errors in the development and testing environments, and will not display any errors in the production environment. https://codeigniter4.github.io/CodeIgniter4/general/errors.html#error-reporting
@codeigniter4/core-team In the current implementation, there is a difference in the conditions for displaying detailed error reports.
display_errors
is onENVIRONMENT
is development
or testing
Thank you very much for your patience in replying. This issue is just a suggestion. I will follow https://codeigniter4.github.io/CodeIgniter4/general/errors.html#error-reporting to complete my project.
Your suggestion has a valid point. At least, the current behaviors are difficult to understand. I think CI4 should be simple as possible.
Therefore I think one of the following would be better.
display_errors
in both (HTML and Non-HTML)CI_DEBUG
in bothI sent PR #9144
Closed by #9144 in v4.6.
in a custom environment. And the environment name is not "development" or "testing". has Internal Server Error in "ajax", not working. It is recommended to change the "system/Debug/ExceptionHandler.php" code: == source code ===
== Modify to ==