Textpattern CMS support forum
- From: Avon Park, FL
- Registered: 2004-02-24
- Posts: 1,184
NULLDATETIME: A Quick Primer
Since 4.6 has been released, there have been a number of plugin issues regarding NULLDATETIME. This is a quick explainer as to why for people who are running into this.
When 4.0.7 was released, it included some changes to Textpattern functionality – allowing for expired articles.
define('NULLDATETIME', 0); // MySQL value for an unset timestamp.
This worked exactly as intended. Until a change was made in MySQL in 5.7.4 and Strict Mode was enabled be default.
It was observed that having a large number of sql modes dependent on STRICT mode creates confusion among users. Specifically, we are talking about NO_ZERO_DATE, NO_ZERO_IN_DATE and ERROR_FOR_DIVISION_BY_ZERO modes. You can se further details on the above sql modes here. These modes only took effect if STRICT mode was also enabled, otherwise they produced warnings. – Improvements to STRICT MODE in MySQL
This potentially breaks any plugin that uses txp NULLDATETIME constant – etc
There are various solutions out there on various threads but I thought it would be good to have one place for those who don’t use the forum search capability to find an answer quickly.
Re: NULLDATETIME: A Quick Primer
Thanks for starting this thread. More curated info for anyone who wants to delve into the various fixes and workarounds people have tried:
- Pesky zero dates.
- The GitHub Issue to track patches.
- Textpattern and MySQL 5.7.
- Do you have a plugin complaining about
undefined constant NULLDATETIME? Here’s some general advice from Ruud on how to patch the plugin.
- Specific fix for the mdn_count plugin, as a concrete example of what Ruud mentions above.
Last edited by Bloke (2016-11-16 16:07:39)