Make WordPress Core

#54841 closed defect (bug) (fixed)

wpdb::has_cap utf8mb4_520 detection does not work properly

Reported by: jamieburchell's profile jamieburchell Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 6.1 Priority: normal
Severity: normal Version: 5.8.3
Component: Database Keywords: has-patch
Focuses: Cc:

Description

The wpdb::has_cap method returns false when testing for utf8mb4_520 support with MariaDB versions 10.3 and 10.5. These are the versions I was able to test. The version string for these returns as 5.5.5, which caps collation support at utf8mb4_unicode_ci. MariaDB 10.3 and 10.5 both have support for utf8mb4_520.

Attachments (1)

54841.diff (3.1 KB) - added by SergeyBiryukov 15 months ago.

Download all attachments as: .zip

Change History (3)

#1 @SergeyBiryukov
15 months ago

  • Keywords has-patch added
  • Milestone changed from Awaiting Review to 6.1
  • Owner set to SergeyBiryukov
  • Status changed from new to accepted

Hi there, welcome to WordPress Trac! Thanks for the ticket.

I was able to reproduce the issue. In my testing, MariaDB version is reported differently between PHP versions, see comment:33:ticket:49364:

  • PHP 8.0.16 or later: 10.6.8-MariaDB
  • PHP 8.0.15 or earlier: 5.5.5-10.6.8-MariaDB

The latter includes PHP 7.4.x and PHP 5.6.x as well, where the version is also reported with the 5.5.5- prefix.

This was previously noted in comment:7:ticket:47738 and appears to be addressed in PHP 8.0.16 or later:

54841.diff follows [53919] / #53623 and makes an adjustment to wpdb::has_cap() to check for the correct MariaDB version. It looks like utf8mb4_520 is available in MariaDB since version 10.2, so the test checks for that.

#2 @SergeyBiryukov
14 months ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 54384:

Database: Correct MariaDB version check in wpdb::has_cap().

MariaDB version is reported differently between PHP versions:

  • PHP 8.0.16 or later: 10.6.8-MariaDB
  • PHP 8.0.15 or earlier: 5.5.5-10.6.8-MariaDB

The latter includes PHP 7.4.x and PHP 5.6.x as well, where the version is also reported with the 5.5.5- prefix.

This commit makes an adjustment to wpdb::has_cap() to check for the correct MariaDB version.

This resolves an issue where the utf8mb4_unicode_520_ci collation, which is available in MariaDB since version 10.2, was previously not detected correctly.

References:

Follow-up to [37523], [53919].

Props jamieburchell, SergeyBiryukov.
Fixes #54841.

Note: See TracTickets for help on using tickets.