Community

Incorrect datetime value?

We’ve just moved a client’s website from an older server Ubuntu 14 PHP 5 to Ubuntu 18.04, php 7.2
MySQL 5.7.
The shopping cart (MiniShop2) has now stopped functioning when the checkout values are submitted and POSTed to /assets/components/minishop2/action.php.

In the MODX error log we see
[2019-07-01 12:55:57] (ERROR @ /home/client/public_html/core/xpdo/om/xpdoobject.class.php : 1452) Error 22007 executing statement:
INSERT INTO modx_ms2_order_addresses (user_id, createdon, receiver, phone, country, index, region, city, street, building, room, comment) VALUES (4, ‘2019-07-01 12:55:57’, ‘Tate’, ‘1524649879’, ‘GB’, ‘LA1 1AA’, ‘Lancs’, ‘Lancaster’, ‘Cameron House, White Cross’, ‘Michael’, ‘White Cross’, ‘’)
Array
(
[0] => 22007
[1] => 1292
[2] => Incorrect datetime value: ‘0000-00-00 00:00:00’ for column ‘updatedon’ at row 1
)

Does anyone know how to fix the error?

Hello,

Welcome to the forums.

What version of MODX are you using?

Are there any minor updates available for your version of Minishop2?

I notice that there was a change in the way years were handled between PHP 5 and PHP 7.2. This may have some bearing on the problem.

Some references that may help:

https://www.php.net/manual/en/class.datetime.php

https://stackoverflow.com/questions/37630980/php-sql-state-22007-when-inserting-date-or-datetime

Thanks, andytough. We’ll take a look.
We’re on 2.6.5-pl. There is an update to MiniShop2 but in addition, it uses MSFieldsManager & MSOptionsPrice from ModStore. Updating breaks the site :frowning: