2
0
forked from Wavyzz/dolibarr

FIX avoid sql error when a comment is after without comma (#33758)

* FIX avoid sql error when a comment is after without comma

* FIX syntax error

* Update admin.lib.php

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This commit is contained in:
Regis Houssin
2025-04-16 20:00:13 +02:00
committed by GitHub
parent 67962812d1
commit 483112810e
2 changed files with 2 additions and 2 deletions

View File

@@ -242,7 +242,7 @@ function run_sql($sqlfile, $silent = 1, $entity = 0, $usesavepoint = 1, $handler
// Add line buf to buffer if not a comment
if ($nocommentremoval || !preg_match('/^\s*--/', $buf)) {
if (empty($nocommentremoval)) {
$buf = preg_replace('/([,;ERLT\)])\s*--.*$/i', '\1', $buf); //remove comment from a line that not start with -- before add it to the buffer
$buf = preg_replace('/([,;ERLT0\)])\s+--.*$/i', '\1', $buf); //remove comment on lines that does not start with --, before adding it to the buffer
}
if ($buffer) {
$buffer .= ' ';