?
avatar wilsonge wilsonge - open - 16 Mar 2016
avatar brianteeman brianteeman - change - 16 Mar 2016
Category Installation SQL Updating
avatar wilsonge wilsonge - change - 16 Mar 2016
Labels Added: ?
avatar wilsonge wilsonge - change - 16 Mar 2016
Labels Added: ?
avatar richard67
richard67 - comment - 16 Mar 2016

Hmm, I just tested and cannot reproduce the isue with 3.5.0 RC 4: I could install weblinks with using the PDO driver for mysql, and weblinks has an update site in its manifest, as required for the test, and all worked well.

Is it maybe related to PHP versions? I tested with 7.

Or has it been solved somehow already since 3.4.8 for which the isue was reported?


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

avatar mbabker
mbabker - comment - 16 Mar 2016

Trying to replicate, hitting other errors, but not this one. Using the weblinks package they posted on joomla-extensions/weblinks#193

PHP 5.5.31, 5.6.17, and 7.0.4 w/ PDO MySQL:

Warning

SQLSTATE[HY000]: General error: 1364 Field 'system_data' doesn't have a default value
Package Install: There was an error installing an extension: com_weblinks.zip

OK, let's try the Akeeba 4.5.5 package since that's what the forum user said they had issues with.

PHP 5.5.31, 5.6.17, and 7.0.4 w/ PDO MySQL:

Warning

SQLSTATE[HY000]: General error: 1364 Field 'system_data' doesn't have a default value

So I can't even get current versions of anything installed to test them.

Fine. Switch over to MySQLi and install Akeeba 4.5.4 since the forum user suggested their issue was with updating the extension. Then switch back to PDO MySQL to run the update. Go into the component, hit his "Reload Update Information" button. Now I'm here w/ PHP 5.6.17:

An error has occurred.
 HY000 SQLSTATE[HY000]: General error: 1364 Field 'data' doesn't have a default value

I give up. I surely can't install or update extensions with Joomla's core update feature on a PDO MySQL setup, but it sure as hell isn't related to that forum post.

avatar richard67
richard67 - comment - 16 Mar 2016

@mbabker Just for curiosity: You did that on a Joomla! 3.4.8 as reported in their forum, or on a 3.5.0 RC 4 (or staging) as I did?

avatar mbabker
mbabker - comment - 16 Mar 2016

Current staging. Because so much has changed since 3.4.8 it'd be pretty difficult to try and confirm an issue there then trace down whether it's fixed or not.

avatar brianteeman
brianteeman - comment - 16 Mar 2016

Which version of mysql are you on? I remember you had issues with other PDO related bug reports which I couldnt replicate on my pdo system with 5.5.42 and php 5.6.10


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

avatar mbabker
mbabker - comment - 16 Mar 2016

5.6.29

avatar brianteeman
brianteeman - comment - 16 Mar 2016

So i am pretty sure based on all of our previous testing that there is an issue which is specific to the mysql version


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

avatar richard67
richard67 - comment - 16 Mar 2016

I had tested with mysql version 5.5.47 and could not reproduce with weblinks.
I will test soon with lower version which does not support utf8mb4.

avatar richard67
richard67 - comment - 16 Mar 2016

Hmm can also not replicate this with PHP 5.6.19 and mysql 5.1.73 on 3.5.0 RC 4 with installing weblinks. The record in the update site table has been added, no errors shown anywhere, also not in php error log file.

avatar andrepereiradasilva
andrepereiradasilva - comment - 17 Mar 2016

Could be this?

MySQL is most likely in STRICT mode. Try running SET GLOBAL sql_mode='' or edit your my.cnf to make sure you aren't setting STRICT_ALL_TABLES or the like.

http://stackoverflow.com/questions/18751291/mysql-error-1364-field-display-name-doesnt-have-default-value

As of MySQL 5.7.5, the default SQL mode includes STRICT_TRANS_TABLES.

http://dev.mysql.com/doc/refman/5.7/en/sql-mode.html

avatar wilsonge
wilsonge - comment - 17 Mar 2016

Possibly but then two things:
1) everyone here has run a maximum MySQL version of 5.6 - so it would have to be manually set to on
2) I think it's more likely to be a MySQL client issue rather than server issue - otherwise we would see this issue manifest on mysqli mode which @mbabker doesn't (as far as I understand)

avatar andrepereiradasilva
andrepereiradasilva - comment - 17 Mar 2016

@wilsonge, mysqli driver sets sql_mode mode to '', pdomysql driver doesn't, i think

See https://github.com/joomla/joomla-cms/blob/staging/libraries/joomla/database/driver/mysqli.php#L187

Also check the default values on 5.6.6+
http://dev.mysql.com/doc/refman/5.6/en/server-system-variables.html#sysvar_sql_mode

@mbabker version is 5.6.29, i.e., 5.6.6+

avatar mbabker
mbabker - comment - 17 Mar 2016
SELECT @@sql_mode;

STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION
avatar andrepereiradasilva
andrepereiradasilva - comment - 17 Mar 2016

5.5.5 (MariaDB 10.0.24)

SELECT @@sql_mode

(empty)

So that seems to be the problem.
an empty sql_mode needs to be added to pdomysql driver too

avatar andrepereiradasilva
andrepereiradasilva - comment - 17 Mar 2016

@mbabker almost bet this (#9380) is caused by the same thing

avatar mbabker
mbabker - comment - 17 Mar 2016

Yes and no. Yes in the fact that changing the sql_mode to the most permissive setting we can guarantees things will work. No in the fact that the value that's trying to be given to the database is technically not valid for the schema but thanks to the loose session settings MySQL will take it.

avatar andrepereiradasilva
andrepereiradasilva - comment - 17 Mar 2016

right, but IMHO you have to options:
1. correct all queries and default values in the database (and you probably will still have issues with extensions) and allow all sql modes
2. or add also the SET SESSION sql_mode = ''; to pdomysql driver like is already in mysql and mysqli drivers.

avatar wilsonge
wilsonge - comment - 17 Mar 2016

@mbabker can you temporarily turn off strict mode then and see if things resolve themselves so we at least replicate the issue :) that's going to at least allow people to reliably formulate a fix :)

avatar andrepereiradasilva
andrepereiradasilva - comment - 17 Mar 2016

BTW, can you confirm that changing the pdomysql sql_mode solves the issues?

avatar mbabker
mbabker - comment - 17 Mar 2016

You do both. The loose settings makes things consistent and makes sure things work, correcting the schema and PHP code to ensure valid values are being generated ensures a valid and consistent dataset across the board. If I'm not mistaken we aren't doing something similar in for PostgreSQL or SQL Server, so something's gotta be working right in those environments.

avatar andrepereiradasilva
andrepereiradasilva - comment - 17 Mar 2016

If I'm not mistaken we aren't doing something similar in for PostgreSQL or SQL Server, so something's gotta be working right in those environments.

or they don't enforce strict modes ... or something like that

avatar andrepereiradasilva
andrepereiradasilva - comment - 17 Mar 2016

You do both. The loose settings makes things consistent and makes sure things work, correcting the schema and PHP code to ensure valid values are being generated ensures a valid and consistent dataset across the board.

Agree.

avatar mbabker
mbabker - comment - 17 Mar 2016

Add this to the end of the PDO MySQL driver's connect method:

// Set sql_mode to non_strict mode
$this->connection->query("SET @@SESSION.sql_mode = '';");

Now I get the message from the forum.

avatar wilsonge
wilsonge - comment - 17 Mar 2016

So you are running 5.6.29, yet Richard with 5.6.19 (presumably with strict mode off else hell would have broken loose for him) gets nothing. So I guess next step is to figure out if it's a server issue specific to a MySQL version or a client issue :/

avatar wilsonge
wilsonge - comment - 17 Mar 2016

We also need to go back and fix strict mode issues

avatar andrepereiradasilva
andrepereiradasilva - comment - 17 Mar 2016

I had tested with mysql version 5.5.47 and could not reproduce with weblinks.

not 5.6.19 (that's his php version)
you need to stop going to the pub ... :D

avatar mbabker
mbabker - comment - 17 Mar 2016

Well. The sql_mode change both fixes and breaks things. Extensions install fine, but none of the update sites are being added to the table. Tried Akeeba, Weblinks, and my own stuff. Nada. Only in Akeeba is that specific error message being displayed for me, but it's not a stack trace you would expect. The error page is getting rendered, then making matters worse the stack trace is on the line where I added the query for the sql_mode change.

screen shot 2016-03-16 at 9 25 47 pm

avatar andrepereiradasilva
andrepereiradasilva - comment - 17 Mar 2016

that's the error message of the user in the forum

HY000 SQLSTATE[HY000]: General error: 2014 Cannot execute queries while other unbuffered queries are active. Consider using PDOStatement::fetchAll(). Alternatively, if your code is only ever going to run against mysql, you may enable query buffering by setting the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute.

avatar mbabker
mbabker - comment - 17 Mar 2016

Right but it's not in a place that's consistent with what the user's saying the error is.

avatar mbabker
mbabker - comment - 17 Mar 2016

var_dump'ing the object getting passed into the error handler + the trace...

screencapture-jcms-administrator-index-php-1458178594392

avatar mbabker
mbabker - comment - 17 Mar 2016

And turning off the debug plugin gets things working again for me.

avatar andrepereiradasilva
andrepereiradasilva - comment - 17 Mar 2016

it seems that are 3 different related things:
1. correct queries and default values in the database where sql_mode strict mode returns errors
2. add also the SET SESSION sql_mode = ''; to pdomysql driver like is already in mysql and mysqli drivers.
3. solve your latest problem that seems to be related to the forum user problem

avatar andrepereiradasilva
andrepereiradasilva - comment - 17 Mar 2016

@mbabker reggarding 3. did you try to add to the pdomysql driver?

$this->connection->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);

Reference: http://php.net/manual/en/ref.pdo-mysql.php

avatar mbabker
mbabker - comment - 17 Mar 2016

Yep, made no difference with that unbuffered query thing.

avatar andrepereiradasilva
andrepereiradasilva - comment - 17 Mar 2016

did you added it before or after the ?

// Set sql_mode to non_strict mode
$this->connection->query("SET @@SESSION.sql_mode = '';");
avatar mbabker
mbabker - comment - 17 Mar 2016

Before.

avatar andrepereiradasilva
andrepereiradasilva - comment - 17 Mar 2016

ok... i cannot replicate your issue. Maybe another mysql default config changed in your version that is causing that.

avatar andrepereiradasilva
andrepereiradasilva - comment - 17 Mar 2016

and if you add

$this->options['driverOptions'] = array(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true);

to the beggining of the pdomysql.php connect method? in other words add that flag on pdo connect, instead of being set after pdo connect.

Update: corrected the code

avatar wilsonge
wilsonge - comment - 17 Mar 2016

I've fixed what I can from here in #9461 - can people in here do some testing please?

avatar wilsonge wilsonge - change - 18 Mar 2016
Status New Closed
Closed_Date 0000-00-00 00:00:00 2016-03-18 23:44:39
Closed_By wilsonge
avatar wilsonge wilsonge - close - 18 Mar 2016
avatar wilsonge wilsonge - close - 18 Mar 2016
avatar wilsonge wilsonge - change - 18 Mar 2016
Labels Removed: ?

Add a Comment

Login with GitHub to post a comment