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

Add additional empty checks after field protection for update/insert. #4195

Merged
merged 4 commits into from
Jan 31, 2021
Merged

Add additional empty checks after field protection for update/insert. #4195

merged 4 commits into from
Jan 31, 2021

Conversation

sfadschm
Copy link
Contributor

Fixes #3896.

Description
This PR adds additional empty data checks to the Model update and insert methods.
These are needed because doProtectFields is currently called after the last empty dataset check, but can further remove elements from the data array.
See linked issue for details.

Will add tests later today.

Checklist:

  • Securely signed commits
  • Unit testing, with >80% coverage
  • Conforms to style guide

@michalsn
Copy link
Member

Yes, it makes sense to throw an exception here instead of a Builder class.

Waiting for tests, thanks.

@sfadschm
Copy link
Contributor Author

Is there a way that I can do the database live test on my local setup? Like it seems like I only need to add credentials somewhere but I can't seem to find where.

@michalsn
Copy link
Member

The simplest way would be to add/edit .env file and fill the database.tests.* part.

@sfadschm
Copy link
Contributor Author

Well yeah, let's just pretend I never asked that....

@michalsn michalsn merged commit 1695369 into codeigniter4:develop Jan 31, 2021
@michalsn
Copy link
Member

Thanks, @sfadschm!

@sfadschm sfadschm deleted the fix-model-empty-check branch January 31, 2021 18:25
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 this pull request may close these issues.

Bug: Premature empty check in Model->update function.
3 participants