-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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: [Model] when the query ($this->first()) result returns NULL we get TypeError #8807
Conversation
Bug: when the query ($this->first()) result returns NULL we get TypeError
Can you add test code?
Also, there are three places that calls
|
I confirm that there is a TypeError error in the methods: doFind and doFirst when using casts |
Fix TypeError error in the methods: doFind and doFirst when using casts
I'm new to Codeigniter and I don't know how to do tests, please help me with this issue. In my opinion, this error is very serious and should be uploaded in the very near future in a new version. |
PRs will not be merged unless there is test code to prove that the bug has been fixed. The test code is a kind of documentation and should be very easy to read and understand immediately. In this case, writing tests is easy. You only need to add tests for the cases where the results are null, referring to existing test cases.
For example, copy this method and write a new test case method: CodeIgniter4/tests/system/Models/DataConverterModelTest.php Lines 33 to 44 in 6934848
First write a new test case, and run it. Then it fails (throwing TypeError). Then fix the product code, and run the test again. If it passes, it shows the bug has been fixed. |
I sent #8871 |
Closed by #8871 |
Description
Fixes #8806
Checklist: