?
avatar 810
810
5 Mar 2016

Steps to reproduce the issue

Install staging build

Expected result

Install joomla

Actual result

SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect datetime value: '0000-00-00 00:00:00' for column 'lastResetTime' at row 1

System information (as much as possible)

Additional comments

avatar 810 810 - open - 5 Mar 2016
avatar brianteeman brianteeman - change - 5 Mar 2016
Category Installation SQL
avatar brianteeman brianteeman - change - 6 Mar 2016
Labels Added: ?
avatar brianteeman
brianteeman - comment - 6 Mar 2016

What were you doing to get that error message.

From what you have written I guessed it was during the install when using mysql(pdo) as the database driver.

I tested current staging and installed it with no sample data, blog sample data and testing sample data. All installed fine with no errorrs


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9310.

avatar brianteeman brianteeman - change - 6 Mar 2016
Status New Information Required
avatar alikon
alikon - comment - 7 Mar 2016

unable to replicate the issue.
@kigh143 did you replicate the issue with that extension ?

avatar crayner
crayner - comment - 11 Mar 2016

Yes, able to duplicate this error. Unable to install new Joomla 3.5 site on PHP 7.0.0 / Apache 2.4.17 / Mysql 5.7.9

Setting in Joomla MYSQL (PDO) Fails creating Admin User

Joomla Setting Mysqli works correctly.

It appears that 0000-00-00 00:00:00 is an invalid value for a datetime using PDO for MySQL.

avatar mbabker
mbabker - comment - 11 Mar 2016

I'm going to suggest this is an issue with MySQL 5.7. Installed from 838a459 on my localhost (PHP 7.0.3, MySQL 5.6.22) and it worked fine.

avatar mbabker
mbabker - comment - 11 Mar 2016

The other option, reading up on things, seems it may also have something to do with a combination of NO_ZERO_DATE and a combination of STRICT_TRANS_TABLES and STRICT_ALL_TABLES modes being enabled, and this wouldn't be MySQL version dependent (although 5.7 does use different defaults compared to 5.6).

avatar crayner
crayner - comment - 11 Mar 2016

I do not believe this is a MySQL 5.7 issue. If so, it would fail using the mysqli driver, but it only fails on the PDO driver. In testing the two drivers, are the settings of NO_ZERO_DATE, STRICT_TRANS_TABLES and STRICT_ALL_TABLES altered. In testing, I only changed the setting of the database connection in Joomla, Apache, PHP and MySQL are not change my me in the testing, but I do not discount the possibility that the DatabaseDriver alters these settings in code on Joomla 3.5

mbabker, are you using MySQLi or PDO as a database connection in Joomla for your test ? For me, MySQLi works as expected, PDO fails.

Thanks, Craig

avatar mbabker
mbabker - comment - 11 Mar 2016

The database driver doesn't alter the sql_mode at all. And all my local tests were with PDO on MySQL 5.6.

I note the 5.7 difference since according to the documentation the default sql_mode for 5.7 is a setting that would prevent the 0000-00-00 00:00:00 date from working (if I've read it right). I couldn't imagine why it would only affect the PDO driver and not the other MySQL based drivers too, but that's not something I've got a setup to dig into at the moment.

avatar mbabker
mbabker - comment - 11 Mar 2016

Oh. I got my answer.

The mysql and mysqli drivers DO alter the sql_mode and they completely remove it. The PDO driver does not.

avatar crayner
crayner - comment - 11 Mar 2016

and removing the NO_ZERO_DATE in my.ini does correct the issue for MySQL 5.7. Thanks Michael. Good spotting..

Craig.

avatar crayner
crayner - comment - 11 Mar 2016

Yes clearing the sql_mode in the PDO driver fixes this issue.

I altered JDatabaseDriverPdo in pdo.php at line 217, replacing line 217 and 218 with this code.. Note that there is not break for pdomysql until after mysql.

            case 'pdomysql':
                if (empty($this->options['driverOptions']))
                    $this->options['driverOptions'] = array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET sql_mode=""');
                else
                    $this->options['driverOptions'][PDO::MYSQL_ATTR_INIT_COMMAND] = 'SET sql_mode=""';
            case 'mysql':

hope this helps in the short term. The reality is that driverOptions may be needed in the configuration.

Regards,

Craig

avatar 810
810 - comment - 11 Mar 2016

yes removing all sql modes fixed the issue

avatar brianteeman
brianteeman - comment - 8 May 2016

Thank you for creating this but it would appear that this has been resolved elsewhere in the code base. If this is not correct then this can be re-opened


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9310.

avatar brianteeman brianteeman - change - 8 May 2016
Status Information Required Closed
Closed_Date 0000-00-00 00:00:00 2016-05-08 15:27:31
Closed_By brianteeman
avatar brianteeman brianteeman - close - 8 May 2016

Add a Comment

Login with GitHub to post a comment