Skip to content

Tests: Fix database charset tests on MariaDB 13.1 - #13497

Closed
MicahelE wants to merge 3 commits into
WordPress:trunkfrom
MicahelE:66072-mariadb-utf8
Closed

MicahelE wants to merge 3 commits into
WordPress:trunkfrom
MicahelE:66072-mariadb-utf8

Conversation

@MicahelE

@MicahelE MicahelE commented Sep 11, 2026 •

Copy link
Copy Markdown

On MariaDB 13.1, four database tests fail. MariaDB changed what the utf8 character set name means. It used to mean the older 3-byte version (utf8mb3), and now it means utf8mb4.

WordPress itself isn't affected. Only the tests are, because they used utf8 and expected the old meaning.

This PR updates the tests so they say exactly which character set they mean:

  • Two test tables now use utf8mb3 instead of utf8.
  • The collation test now uses utf8mb4_general_ci, which gives the same result on every server.

Testing

I tested on MariaDB 13.1.1 using MariaDB's development image (quay.io/mariadb-foundation/mariadb-devel:13.1), because 13.1 isn't on Docker Hub yet.

Server trunk This PR
MariaDB 13.1.1 4 failures, the ones in the ticket All 100 pass
MariaDB 11.4 with --old-mode= (same change as 13.1) 4 failures All 100 pass
MariaDB 11.4, default settings Not run All 100 pass
MySQL 8.4 Not run All 100 pass

To run them: vendor/bin/phpunit tests/phpunit/tests/db/charset.php

Trac ticket: https://core.trac.wordpress.org/ticket/66072

Use of AI Tools

AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5
Used for: Finding the cause, writing the test changes, and running the tests on each server. I reviewed the changes and take responsibility for them.


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

MariaDB 13.1 removes `UTF8_IS_UTF8MB3` from the default `old_mode`, so the `utf8`
alias now creates `utf8mb4` instead of `utf8mb3`. Four tests in `Tests_DB_Charset`
relied on the alias meaning 3-byte UTF-8.

Declare `utf8mb3` explicitly in the affected data sets, and use `utf8mb4` in the
`set_charset()` collation test, so the expectations no longer depend on the server.

Fixes #66072.
@github-actions

github-actions Bot commented Sep 11, 2026 •

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs.

Core Committers: Use this line as a base for the props when committing in SVN:

Props micahele, lancewillett.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues were identified for the charset-test updates and Windows setup guidance.

No open issues 🎉

What changed in this PR

This PR makes database charset tests independent of the changed utf8 alias in MariaDB 13.1, without changing WordPress runtime behavior. It also adds Windows development setup guidance.

Changes:

  • Uses explicit utf8mb3 character sets in two test table definitions.
  • Uses utf8mb4_general_ci for the connection collation assertion and adds ticket references.
  • Documents recommended WSL setup and Docker’s Linux-container mode on Windows.
File Description
tests/​phpunit/​tests/​db/​charset.php Makes charset and collation tests independent of server alias behavior.
README.md Adds Windows-specific WSL and Docker setup instructions.

Review effort: Balanced

@lancewillett

Copy link
Copy Markdown
Member

The charset suite passes locally on MariaDB 11.8 in randomized single-site and multisite runs: 100 tests, 203 assertions, one existing skip in each. The explicit three-byte fixtures preserve their intended distinction. This does not independently verify MariaDB 13.1, and six CI jobs remain cancelled.

Optional scope cleanup: please move the unrelated Windows/WSL README instructions to a separate PR.

AI review · gpt-6

@lancewillett lancewillett left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified on actual MariaDB 13.1.2 with its default empty old_mode, PHP 8.3 and PHPUnit 9.6.38. The existing charset suite had four failures before the patch in both single-site and multisite. With the patch, both runs passed: 100 tests, 203 assertions, one unchanged existing skip, using the same random seed. PHP lint and coding standards also pass.

The explicit utf8mb3 fixtures restore the intended three-byte/four-byte distinction; this fixes a server-dependent fixture assumption without weakening those assertions.

I refreshed the branch from trunk. The already-landed README change drops out, and the reviewed charset patch is unchanged. Approved; fresh CI is running before landing.

AI review · gpt-6

wporg-sync pushed a commit that referenced this pull request Oct 31, 2026
Use `utf8mb3` where fixtures require three-byte UTF-8, and explicit `utf8mb4` collations for the connection test. This avoids relying on the `utf8` alias, which resolves to `utf8mb4` by default in MariaDB 13.1.

Developed in: #13497

Props micahele.
Fixes #66072.


git-svn-id: https://develop.svn.wordpress.org/trunk@65155 602fd350-edb4-49c9-b593-d223f7449a82
@github-actions

Copy link
Copy Markdown

A commit was made that fixes the Trac ticket referenced in the description of this pull request.

SVN changeset: 65155
GitHub commit: 7b4e9b1

This PR will be closed, but please confirm the accuracy of this and reopen if there is more work to be done.

@github-actions github-actions Bot closed this Oct 31, 2026
wporg-sync pushed a commit to WordPress/WordPress that referenced this pull request Oct 31, 2026
Use `utf8mb3` where fixtures require three-byte UTF-8, and explicit `utf8mb4` collations for the connection test. This avoids relying on the `utf8` alias, which resolves to `utf8mb4` by default in MariaDB 13.1.

Developed in: WordPress/wordpress-develop#13497

Props micahele.
Fixes #66072.

Built from https://develop.svn.wordpress.org/trunk@65155


git-svn-id: http://core.svn.wordpress.org/trunk@64304 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants