Vasek Keberdle Sat May 14 15:43:05 -0400 2016

Subject: PHP7 Incorrect datetime value: '2016-05-14 19:34:37 UTC'

Hi, I am testing app on PHP7 ( on PHO5.6 works well) and i get error :

$database->date = new \DateTime();

Fatal error: Uncaught ActiveRecord\DatabaseException: 22007, 1292, Incorrect datetime value: '2016-05-14 19:34:37 UTC' for column 'date'
at row 1 in ,includes/classes/php-activerecord/lib/Connection.php:276
Stack trace:
#0 ,includes/classes/php-activerecord/lib/Table.php(328): ActiveRecord\Connection->query('UPDATE `zs_min_...', Array)
#1 ,includes/classes/php-activerecord/lib/Model.php(844): ActiveRecord\Table->update(Array, Array)
#2 ,includes/classes/php-activerecord/lib/Model.php(758): ActiveRecord\Model->update(true)
#3 ,includes/classes/MyCLass.php(128): ActiveRecord\Model->save()

mysql --version
mysql Ver 14.14 Distrib 5.6.27, for Linux (x86_64) using EditLine wrapper
PHP Version => 7.0.0-dev


Vasek Keberdle Sat May 14 16:04:27 -0400 2016

Help edit Connection.php
public function datetime_to_string($datetime) {
return $datetime->format('Y-m-d H:i:s');
}

Alexander Matrosov Wed May 18 15:03:51 -0400 2016

after the initialization list the following code

ActiveRecord\Connection::$datetime_format = 'Y-m-d H:i:s';

(1-2/2)