Module install breaks on MySQL 8.0.22+ (General error: 3995 Character set 'utf8_bin' cannot be used in conjunction with 'binary' in call to regexp_like)

Created on 6 February 2021, over 3 years ago
Updated 7 February 2024, 9 months ago

Problem/Motivation

With MySQL 8.0.22, per the changelog:

Regular expression functions such as REGEXP_LIKE() yielded inconsistent results with binary string arguments. These functions now reject binary strings with an error. (Bug #31031886, Bug #98951, Bug #31031888, Bug #98950)

As a result, using BINARY (vs. NOT REGEXP) as an option (per the default setting upon install and the module's config form for transliteration_file_lowercase === TRUE), no longer work.

Steps to reproduce

Download the module and attempt to enable/install Transliteration while using MySQL 8.0.22+ as your site's database. In my case, it returns the following error (though the character set may vary for other users):

SQLSTATE[HY000]: General error: 3995 Character set 'utf8_bin' cannot be used in conjunction with 'binary' in call to regexp_like.

Proposed resolution

Update the SQL statement to cast the uri as BINARY for MySQL databases.

Remaining tasks

Review the attached patch and see if it works correctly on MySQL 8.0.22 and lower MySQL versions.

User interface changes

None.

API changes

None.

Data model changes

None.

🐛 Bug report
Status

Fixed

Version

3.0

Component

Code

Created by

🇺🇸United States aubjr_drupal

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024