? Pending

User tests: Successful: Unsuccessful:

avatar richard67
richard67
15 Mar 2016

Pull Request for parts of issue #9423 .

Summary of Changes

This pull request changes the collation of column lang_code in the languages table #__languages from utf8mb4_unicode_ci (or utf8_unicode_ci) to utf8mb4_bin or utf8_bin to avoid errors with impossible implicit character set conversion on joining other tables' columns.

Since this is the most likely use case for joins making problems, it should solve issue #9423 mostly.

In discussions there was reported that this worked for all extensions and character set and collations combinations tested there.

Testing Instructions

To apply this PR it is not sufficient to apply the patch with patchtester only, it is in addition necessary to change collation of the lang_code column of the languages table. This can be done by forcing the utf8(mb4) conversion to run, which makes also this conversion.

The conversion run can be forced by issuing following SQL statement in phpmyadmin:

UPDATE #__utf8_conversion SET converted= 0;

(replace "#__" by your db prefix).

Then goto Extensions -> Manage -> Update and see that the conversion has to be done being reported as open problem.

Use the "Fix" button to run the conversion.

If I did not make any mistake in the conversion sql script, this should not cause any errors. Please check also this.

Then use following sql statement to test a join query:

SELECT c.*, a.name AS asset_name, l.title AS language_title, u.name AS user_name FROM #__categories AS c LEFT JOIN #__assets AS a ON a.id = c.asset_id LEFT JOIN #__languages AS l ON l.lang_code = c.language LEFT JOIN #__users AS u ON u.id = c.created_user_id;

On unpatched 3.5.0 RC 3 this will break with an sql error about invalid implicit character set or collation conversions, with this patch applied and the conversion run it will succeed.

You can try different combinations of collations by modifying character set and collation of column languagein the #__categories table and then doing the above query again.

Also test on a not utf8mb4 capable database that the database fix for doing the conversion works there, too.

avatar richard67 richard67 - open - 15 Mar 2016
avatar richard67 richard67 - change - 15 Mar 2016
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 15 Mar 2016
Labels Added: ?
avatar richard67
richard67 - comment - 15 Mar 2016

Maybe I should change other language code columns, eg languagein table #__categories, too?

What do you think, guys?


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

avatar mbabker
mbabker - comment - 15 Mar 2016

Do you need to? If it works fine with just the field in the languages table changed then leave it at this.

avatar richard67
richard67 - comment - 15 Mar 2016

Depends on how people join ... if they join to the language table's lang_code column, or maybe join directly to e.g. the categories language column if that makes sense for them.

avatar richard67
richard67 - comment - 15 Mar 2016

But if they wanna be sure that the language exists (i.e. is installed) they always should use the languages table to join with, I think.

avatar mbabker
mbabker - comment - 15 Mar 2016

If you're gonna try to account for every scenario someone might be doing then the only thing you can do is revert back to the 3.4.8 state and make zero changes at all. This change is acceptable as it is.

avatar richard67
richard67 - comment - 15 Mar 2016

Ok, then test please :tongue:

avatar richard67
richard67 - comment - 15 Mar 2016

If I shall do it for other columns, too, like session_id or menutype, then let me know here. But as far as I could see lang_code was most urgent.

avatar mbabker
mbabker - comment - 15 Mar 2016

The unpopular opinion (I'm full of them).

If you're doing something where you're joining to the session table (meaning you're joining on its session_id PK), you probably should be should be storing the data in the session to begin with and if you aren't you need to refactor away from relying on that table, especially if the day ever comes when Joomla can run without that session table (I'm already icing champagne for that occasion).

The menutypes table, core already makes the big no-no of joining on the text based column instead of the table's integer PK (but this is fine since core's schema is also changing). I'd suggest that a data migration needs to happen sooner or later to use the proper PK for the join instead of the text column long term. Short term, to be quite frank I don't know what the "right" answer is but given that field doesn't have a standard text definition (it's user input), I'm apt to say make no changes from this point.

avatar richard67
richard67 - comment - 15 Mar 2016

Thanks for your opinion, Michael. Sounds very reasonable to me. So if no news from @beat this PR here should do it for now (i.e. the coming 3.5.0).

avatar beat
beat - comment - 15 Mar 2016

i agree with @mbabker (as most of the time :smile: ). Sounds more than reasonable and as I understand it fixes com_weblinks too.

avatar richard67
richard67 - comment - 15 Mar 2016

I just simplified testing instructions and made them more precise, so testers are welcome :smile:

avatar andrepereiradasilva
andrepereiradasilva - comment - 15 Mar 2016
  1. Installed latest staging with sample data, patchtester and weblinks (https://github.com/joomla-extensions/weblinks/releases/download/3.4.1/pkg_weblinks_3.4.1.zip)
  2. Applied your patch
  3. Run the query to set the utf conversion table to 0
  4. Gone to Extensions -> Manage -> Update, a message appeared, pressed "fix"
  5. Fix went fine.
  6. Gone to phpmyadmin checked #__languages table and the lang_code field uses utf8mb4_bin collation. All ok
  7. Gone to weblinks (language field is utf8_general_ci collation). All ok

Tested on Database Version 5.5.5-10.0.24-MariaDB

avatar richard67
richard67 - comment - 15 Mar 2016

I just see simplified testing insructions are not visible yet on issue tracker, have updated via GitHub where they are visible.

But you already helped yourself, thanks for testing.


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

avatar richard67
richard67 - comment - 15 Mar 2016

Now the issue tracker has the changed instructions, too.


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

avatar richard67
richard67 - comment - 15 Mar 2016

@andrepereiradasilva Did you forget to mark test result? Or wanted to do some more tests?


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

avatar wilsonge wilsonge - change - 15 Mar 2016
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2016-03-15 23:44:06
Closed_By wilsonge
avatar wilsonge wilsonge - close - 15 Mar 2016
avatar wilsonge wilsonge - merge - 15 Mar 2016
avatar wilsonge wilsonge - reference | 6ac3dc4 - 15 Mar 16
avatar wilsonge wilsonge - merge - 15 Mar 2016
avatar wilsonge wilsonge - close - 15 Mar 2016
avatar richard67 richard67 - head_ref_deleted - 15 Mar 2016
avatar JoomliC JoomliC - test_item - 16 Mar 2016 - Tested successfully
avatar JoomliC
JoomliC - comment - 16 Mar 2016

I have tested this item :white_check_mark: successfully on 9da1c06

Tested succesfully on 2 install : one with utf8mb4 support and one with no utf8mb4 support
2 tests success!
Note: i've tested with com_weblinks, but with other extensions i've found on the JED having this illegal mix of collations, and all seems good! :+1:


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

avatar richard67
richard67 - comment - 16 Mar 2016

Good to hear that.

avatar JoomliC
JoomliC - comment - 16 Mar 2016

@richard67 @mbabker @beat @andrepereiradasilva @wilsonge ... Thank You for all your time dedicated on this issue and 3.5.0 release! ;-)

avatar beat
beat - comment - 16 Mar 2016

@JoomliC Thank you too! :smile:

avatar richard67
richard67 - comment - 16 Mar 2016

Welcome.

Add a Comment

Login with GitHub to post a comment