Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2016-11-16 15:45:18

michaelkpate
Moderator
From: Avon Park, FL
Registered: 2004-02-24
Posts: 1,379
Website GitHub Mastodon

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

#2 2016-11-16 16:05:44

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,250
Website GitHub

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:

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

Board footer

Powered by FluxBB