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: CI4 Undefined Variable returns error 500 and stops the script #8351

Closed
mywebmanavgat opened this issue Dec 20, 2023 · 2 comments
Closed

Comments

@mywebmanavgat
Copy link

PHP Version

7.4, 8.0, 8.1, 8.2

CodeIgniter4 Version

4.4.3

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

None

What happened?

Ci4 Undefined Variable returns error 500 and stops the script on that line.

Also in ci3, even if these errors are not shown on the screen in production mode, ci3 logs these errors and shows you the errors for you to debug.

Ci4 interrupts and kills the process with a 500 error on undefined variable error.
If you set error_log(0) for ci4 production.php, it will not generate 500 errors, it will continue processing as in natural php, but it will not record any logs for this error.

Steps to Reproduce

I have no idea about this but exceptionHandler should be customizable.

Expected Output

Expected output, in production mode, the native php script continues processing.

Anything else?

I recorded a video for ci3 and ci4. You can understand what I want to explain more clearly by watching the video.

https://www.youtube.com/watch?v=eoKgtHeXohM

@mywebmanavgat mywebmanavgat added the bug Verified issues on the current code behavior or pull requests that will fix them label Dec 20, 2023
@kenjis
Copy link
Member

kenjis commented Dec 20, 2023

It is true that the CI4's behavior is different from CI3's, but I don't think this is a bug.
See #8350

You can customize Exceptions.
See https://codeigniter4.github.io/CodeIgniter4/extending/core_classes.html#replacing-core-classes

@kenjis kenjis changed the title Bug: Bug: Ci4 Undefined Variable returns error 500 and stops the script Dec 20, 2023
@kenjis kenjis changed the title Bug: Ci4 Undefined Variable returns error 500 and stops the script Bug: CI4 Undefined Variable returns error 500 and stops the script Dec 20, 2023
@kenjis kenjis removed the bug Verified issues on the current code behavior or pull requests that will fix them label Dec 20, 2023
@kenjis
Copy link
Member

kenjis commented Dec 26, 2023

This is not a bug, and we have updated the docs:
See https://codeigniter4.github.io/CodeIgniter4/installation/upgrade_4xx.html#error-handling

@kenjis kenjis closed this as completed Dec 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants