CommandStringHelper: fixed backslashes not being removed from escaped quotes

this time, without breaking eval commands ... stripslashes likes to strip ALL backslashes, whether they are actually escaping something or not, which is super annoying.
This commit is contained in:
Dylan K. Taylor
2022-05-10 15:09:57 +01:00
parent 6da53536ca
commit d2e421c424

View File

@ -49,7 +49,7 @@ final class CommandStringHelper{
foreach($matches[0] as $k => $_){ foreach($matches[0] as $k => $_){
for($i = 1; $i <= 2; ++$i){ for($i = 1; $i <= 2; ++$i){
if($matches[$i][$k] !== ""){ if($matches[$i][$k] !== ""){
$args[(int) $k] = $i === 1 ? stripslashes($matches[$i][$k]) : $matches[$i][$k]; $args[(int) $k] = preg_replace('/\\\\([\\\\"])/u', '$1', $matches[$i][$k]);
break; break;
} }
} }