Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
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.
In order to make this happen, a constant was added to /textpattern/lib/constants.php.
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
Obviously, this presented a problem. Which was corrected in 4.6. The constant is no longer defined and a new method is in places which fixes the core issues. But can cause problems for plugins.
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.
Offline
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)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
Pages: 1