Skip to content

Mediawiki requires patch to work with MariaDB 12

Description:

MariaDB 12 changed its read-only status from a boolean to an enum and presents this status as "ON"/"OFF". Casting these enum values to boolean in PHP results in true, causing MediaWiki to now treat the database as being read-only. On my system, one symptom of this is that login attempts are denied to prevent CSRF, presumably due to session tokens no longer being written to the database.

Additional info:

Steps to reproduce:

  1. Install mariadb-11.8.2-1 and mediawiki-1.44.0-1. Configure MediaWiki to require logins.
  2. Upgrade to mariadb-12.0.2-1.
  3. Observe that you can no longer log into MediaWiki.

The upstream MediaWiki bug report was resolved by the following patch: https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/core/+/54d2416fbcb3a7d0e2a197ca58a755134bd18866%5E%21/#F0

This issue was fixed for me by applying the following analogous patch to my system:

--- mediawiki-orig/includes/libs/rdbms/database/DatabaseMySQL.php       2025-08-21 11:07:49.673960259 -0400
+++ mediawiki/includes/libs/rdbms/database/DatabaseMySQL.php    2025-08-21 11:08:25.125293150 -0400
@@ -384,7 +384,7 @@
                $res = $this->query( $query, __METHOD__ );
                $row = $res->fetchObject();

-               return $row && (bool)$row->Value;
+               return $row && $row->Value && $row->Value !== 'OFF';
        }

        /**
Edited by Jed
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information