FIX: more correctly parse the select part to be replaced in sql queries

This commit is contained in:
Marc de Lima Lucio
2023-11-09 17:04:13 +01:00
parent cfe1b17a76
commit a3fa8b82fa
6 changed files with 7 additions and 7 deletions

View File

@@ -369,7 +369,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
$nbtotalofrecords++;
}*/
/* The fast and low memory method to get and count full list converts the sql into a sql count */
$sqlforcount = preg_replace('/^SELECT[a-z0-9\._\s\(\),]+FROM/i', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql);
$sqlforcount = preg_replace('/^SELECT[a-z0-9\._\s\(\),=<>\:\-\'\+\*\/"`]+\sFROM/Ui', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql);
$resql = $db->query($sqlforcount);
$objforcount = $db->fetch_object($resql);
$nbtotalofrecords = $objforcount->nbtotalofrecords;