mirror of
https://github.com/FOSSBilling/FOSSBilling.git
synced 2026-12-01 12:48:08 +09:00
Fix MySQL 8.0.22+ REGEXP charset conflict in patches 67 and 74 (#3822)
* Fix MySQL 8.0.22+ REGEXP charset conflict in patches 67 and 74 MySQL 8.0.22+ changed the REGEXP implementation to use ICU internals, which rejects operands with mismatched character sets. Using `BINARY hash` (producing binary charset) alongside a pattern literal with the session charset (e.g. utf8mb3_general_ci) triggers: SQLSTATE[HY000]: General error: 3995 Character set 'binary' cannot be used in conjunction with 'utf8mb3_general_ci' in call to regexp_like. Replace `BINARY hash NOT REGEXP '^[a-f0-9]+$'` in both patches with `CAST(hash AS BINARY) NOT REGEXP _binary'^[a-f0-9]+$'`, making both operands explicitly binary. This preserves the original case-sensitive matching behaviour while being compatible with MySQL 8.0+ and MariaDB. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PNZCQ7v3gm6fc6t98TyZGP * Fix invoice hash regexp charset handling --------- Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
1 parent
6ae4bc131c
commit
ed89bf3731
1 file changed
+2
-2
@@ -1504,7 +1504,7 @@ class UpdatePatcher implements InjectionAwareInterface
|
||||
$expires = $this->computeInvoiceHashExpiration();
|
||||
$rows = $this->fetchAll(
|
||||
"SELECT id FROM invoice WHERE hash IS NOT NULL
|
||||
AND (LENGTH(hash) < 30 OR LENGTH(hash) > 60 OR BINARY hash NOT REGEXP '^[a-f0-9]+$')"
|
||||
AND (LENGTH(hash) < 30 OR LENGTH(hash) > 60 OR CONVERT(hash USING utf8mb4) COLLATE utf8mb4_bin NOT REGEXP '^[a-f0-9]+$')"
|
||||
);
|
||||
foreach ($rows as $row) {
|
||||
$this->executeSql(
|
||||
@@ -1879,7 +1879,7 @@ class UpdatePatcher implements InjectionAwareInterface
|
||||
// Backfill hashes NULLed by the original revision of patch67.
|
||||
$expires = $this->computeInvoiceHashExpiration();
|
||||
$rows = $this->fetchAll(
|
||||
"SELECT id FROM invoice WHERE hash IS NULL OR LENGTH(hash) < 30 OR LENGTH(hash) > 60 OR BINARY hash NOT REGEXP '^[a-f0-9]+$'"
|
||||
"SELECT id FROM invoice WHERE hash IS NULL OR LENGTH(hash) < 30 OR LENGTH(hash) > 60 OR CONVERT(hash USING utf8mb4) COLLATE utf8mb4_bin NOT REGEXP '^[a-f0-9]+$'"
|
||||
);
|
||||
foreach ($rows as $row) {
|
||||
$this->executeSql(
|
||||
|
||||
Reference in new issue
Block a user