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

[NFC/Unit test] - Failing test demonstrating blank timestamp updates #20891

Merged
merged 1 commit into from
Jul 18, 2021

Conversation

demeritcowboy
Copy link
Contributor

@demeritcowboy demeritcowboy commented Jul 17, 2021

Overview

This will fail at the moment.

In civicrm/civicrm-packages#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

DB Error: unknown error
Incorrect datetime value: '0' for column whatever at row 1

After

After civicrm/civicrm-packages#326, stores null in the db

Technical Details

It only fails if sql_mode has NO_ZERO_DATE.

Comments

#20476

@civibot
Copy link

civibot bot commented Jul 17, 2021

(Standard links)

@seamuslee001
Copy link
Contributor

Test fail expected

@seamuslee001
Copy link
Contributor

CRM_Core_DAOTest::testUpdateTimestampWithBlankDate
Exception: PEAR_Exception: "DB Error: unknown error"
 * ERROR TYPE: DB_Error
 * ERROR CODE: -1
 * ERROR MESSAGE: DB Error: unknown error
 * ERROR MODE: 16
 * ERROR USERINFO: UPDATE  `civicrm_cache`  SET `group_name` = 'mytest' , `path` = 'mypath' , `data` = 'some updated data' , `created_date` = 20210717231255 , `expired_date` = 0   WHERE (  `civicrm_cache`.`id` = 487 )   [nativecode=1292 ** Incorrect datetime value: '0' for column 'expired_date' at row 1]
 * ERROR DEBUGINFO: UPDATE  `civicrm_cache`  SET `group_name` = 'mytest' , `path` = 'mypath' , `data` = 'some updated data' , `created_date` = 20210717231255 , `expired_date` = 0   WHERE (  `civicrm_cache`.`id` = 487 )   [nativecode=1292 ** Incorrect datetime value: '0' for column 'expired_date' at row 1]

@seamuslee001
Copy link
Contributor

now that civicrm/civicrm-packages#326 has been merged, Jenkins retest this please

@demeritcowboy
Copy link
Contributor Author

Thanks @seamuslee001

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

Successfully merging this pull request may close these issues.

2 participants