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: [Model] when the query ($this->first()) result returns NULL we get TypeError #8806

Closed
avegacms opened this issue Apr 19, 2024 · 2 comments · Fixed by #8871
Closed

Bug: [Model] when the query ($this->first()) result returns NULL we get TypeError #8806

avegacms opened this issue Apr 19, 2024 · 2 comments · Fixed by #8871
Labels
bug Verified issues on the current code behavior or pull requests that will fix them database Issues or pull requests that affect the database layer

Comments

@avegacms
Copy link
Contributor

PHP Version

8.1, 8.2

CodeIgniter4 Version

4.5.1

CodeIgniter4 Installation Method

Composer (using codeigniter4/appstarter)

Which operating systems have you tested for this bug?

Linux

Which server did you use?

apache

Database

MariaDB 10.2

What happened?

When the query result returns NULL we get TypeError
CI bug
I am using CodeIgniter’s Model + Casts + return type object)

Steps to Reproduce

Run some query with $this->first()

Expected Output

return NULL

Anything else?

No response

@avegacms avegacms added the bug Verified issues on the current code behavior or pull requests that will fix them label Apr 19, 2024
avegacms added a commit to avegacms/CodeIgniter4 that referenced this issue Apr 19, 2024
Bug: when the query ($this->first()) result returns NULL we get TypeError
@kenjis kenjis changed the title Bug: when the query ($this->first()) result returns NULL we get TypeError Bug: [Model] when the query ($this->first()) result returns NULL we get TypeError Apr 19, 2024
@kenjis kenjis added the database Issues or pull requests that affect the database layer label Apr 19, 2024
@neznaika0
Copy link
Contributor

I get the same error. Checking for NULL solves the problem (in this case)

kenjis pushed a commit to kenjis/CodeIgniter4 that referenced this issue May 8, 2024
Bug: when the query ($this->first()) result returns NULL we get TypeError
@kenjis
Copy link
Member

kenjis commented May 8, 2024

Try #8871

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 database Issues or pull requests that affect the database layer
Projects
None yet
3 participants