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

Query Builder getWhere Crash #2143

Closed
entrinix opened this issue Aug 13, 2019 · 0 comments · Fixed by #2232
Closed

Query Builder getWhere Crash #2143

entrinix opened this issue Aug 13, 2019 · 0 comments · Fixed by #2232

Comments

@entrinix
Copy link

Describe the bug
When using the Query Builder, the getWhere method crashes if no offset is given with "Argument 2 passed to CodeIgniter\Database\BaseBuilder::limit() must be of the type int, null given"

The default offset should be zero, and if an int is entered, it would use that.

CodeIgniter 4 version
BETA4

Affected module(s)
/vendor/codeigniter4/framework/system/Database/BaseBuilder.php line 1612

Expected behavior, and steps to reproduce if appropriate
->getWhere([
'email' => $email,
], 1);

will crash

->getWhere([
'email' => $email,
], 1, 0);

will run as expected.

Suggest changing line 1603 of /vendor/codeigniter4/framework/system/Database/BaseBuilder.php

from

public function getWhere($where = null, int $limit = null, int $offset = null)

to

public function getWhere($where = null, int $limit = null, int $offset = 0)

Context

  • PHP version 7.3.8
@jim-parry jim-parry added this to the 4.0.0-rc.2 milestone Sep 8, 2019
michalsn added a commit to michalsn/CodeIgniter4 that referenced this issue Sep 19, 2019
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

Successfully merging a pull request may close this issue.

2 participants