Merge branch '20.0' of git@github.com:Dolibarr/dolibarr.git into 21.0

This commit is contained in:
Laurent Destailleur
2025-05-20 21:59:28 +02:00
2 changed files with 20 additions and 1 deletions

View File

@@ -1005,6 +1005,7 @@ function GETPOST($paramname, $check = 'alphanohtml', $method = 0, $filter = null
'@phan-var-force string $paramname';
if (!is_array($out) && empty($_POST[$paramname]) && empty($noreplace)) {
$reg = array();
$regreplace = array();
$maxloop = 20;
$loopnb = 0; // Protection against infinite loop
@@ -1054,11 +1055,17 @@ function GETPOST($paramname, $check = 'alphanohtml', $method = 0, $filter = null
} elseif ($reg[1] == 'ID') {
$newout = '__ID__'; // We keep __ID__ we find into backtopage url
} else {
$newout = ''; // Key not found, we replace with empty string
$newout = 'REGREPLACE_'.$loopnb; // Key not found, we replace with temporary string to reload later
$regreplace[$loopnb] = $reg[0];
}
//var_dump('__'.$reg[1].'__ -> '.$newout);
$out = preg_replace('/__'.preg_quote($reg[1], '/').'__/', $newout, $out);
}
if (!empty($regreplace)) {
foreach ($regreplace as $key => $value) {
$out = preg_replace('/REGREPLACE_'.$key.'/', $value, $out);
}
}
}
// Check type of variable and make sanitization according to this