On the page detail.php: clicking the 'Spam' checkbox to open rep_message_listing.php, a fatal error is thrown that stops the page from loading anything after the call to db_colorised_table().
Steps to reproduce
Open details for a message to get to details.php
Click the 'Spam' checkbox.
rep_messages_listing.php loads the header information but displays no result.
Expected result
Show a table with information.
Actual result
HTTP Error log:
[Wed Jan 10 10:18:41.494527 2024] [php7:error] [pid 1133123] [client :19041] PHP Fatal error: Uncaught mysqlisql exception: Illegal argument to a regular expression. in /var/www/html/mailscanner/functions.php:1051Stack trace:\n#0 /var/www/ht ml/mailscanner/functions.php(1051): mysqli->query('SELECT COUNT()...')\n#1 /var/www/html/mailscanner/functions.php(2019): dbquery ('SELECT COUNT()...')\n#2 /var/www/html/mailscanner/functions.php(2088): generatePager('\n SELECT\n id A...')\n#3 /var/www/htm l/mailscanner/rep_message_listing.php(125): db_colorised_table('\n SELECT\n id A...', 'Message Listing', true, true)\n#4 {main} \n thrown in /var/www/html/mailscanner/functions.php on line 1051, referer: https://redacted.com/mailscanner/detail.php?token=&id=
Installation
I'm using MailWatch & MailScanner latest Versions on Debian 11 with PHP 7.3 & MySQL 8.0.33
Proposed Fix
In MySQL 8.0.4 and above, regex implementation changed. See https://dev.mysql.com/doc/refman/8.0/en/regexp.html#regexp-compatibility
In my case, I simply changed '[[:<:]]' and '[[:>:]]' with '\b'.
rep_message_listing.php, line 102 before:
$relay_regex = '[[:<:]]' . str_replace('.', '.', deepSanitizeInput($_GET['relay'], 'url')) . '[[:>:]]';
Line 102 fixed:
$relay_regex = '\b' . str_replace('.', '.', deepSanitizeInput($_GET['relay'], 'url')) . '\b';
Issue summary
On the page detail.php: clicking the 'Spam' checkbox to open rep_message_listing.php, a fatal error is thrown that stops the page from loading anything after the call to db_colorised_table().
Steps to reproduce
Expected result
Show a table with information.
Actual result
HTTP Error log: [Wed Jan 10 10:18:41.494527 2024] [php7:error] [pid 1133123] [client:19041] PHP Fatal error: Uncaught mysqlisql exception: Illegal argument to a regular expression. in /var/www/html/mailscanner/functions.php:1051Stack trace:\n#0 /var/www/ht ml/mailscanner/functions.php(1051): mysqli->query('SELECT COUNT()...')\n#1 /var/www/html/mailscanner/functions.php(2019): dbquery ('SELECT COUNT()...')\n#2 /var/www/html/mailscanner/functions.php(2088): generatePager('\n SELECT\n id A...')\n#3 /var/www/htm l/mailscanner/rep_message_listing.php(125): db_colorised_table('\n SELECT\n id A...', 'Message Listing', true, true)\n#4 {main} \n thrown in /var/www/html/mailscanner/functions.php on line 1051, referer: https://redacted.com/mailscanner/detail.php?token=&id=
Installation
I'm using MailWatch & MailScanner latest Versions on Debian 11 with PHP 7.3 & MySQL 8.0.33
Proposed Fix
In MySQL 8.0.4 and above, regex implementation changed. See https://dev.mysql.com/doc/refman/8.0/en/regexp.html#regexp-compatibility In my case, I simply changed '[[:<:]]' and '[[:>:]]' with '\b'. rep_message_listing.php, line 102 before: $relay_regex = '[[:<:]]' . str_replace('.', '.', deepSanitizeInput($_GET['relay'], 'url')) . '[[:>:]]'; Line 102 fixed: $relay_regex = '\b' . str_replace('.', '.', deepSanitizeInput($_GET['relay'], 'url')) . '\b';