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

Also check timestamp types for update() when trying to update a timestamp field with a blank value #326

Merged
merged 1 commit into from
Jul 18, 2021

Conversation

demeritcowboy
Copy link
Contributor

Overview

In #319 insert() was patched to also look for timestamp db fields when inserting a blank date in a field that allows nulls. But update() was not also patched so it has the same problem with timestamp types.

Before

See unit test at civicrm/civicrm-core#20891 - it fails with:
DB Error: unknown error
Incorrect datetime value: '0' for column whatever at row 1

After

stores null in the db

Technical Details

It only fails if sql_mode has NO_ZERO_DATE.

Comments

civicrm/civicrm-core#20476

@civibot
Copy link

civibot bot commented Jul 17, 2021

(Standard links)

@civibot civibot bot added the master label Jul 17, 2021
@demeritcowboy demeritcowboy changed the title also do timestamp types Also check timestamp types for update() when trying to update a timestamp field with a blank value Jul 17, 2021
@seamuslee001
Copy link
Contributor

Looks fine to me

@seamuslee001 seamuslee001 merged commit 6998b96 into civicrm:master Jul 18, 2021
@demeritcowboy demeritcowboy deleted the timestamp-update-null branch July 18, 2021 00:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants