From: Tim Düsterhus Date: Fri, 24 Jun 2022 09:02:04 +0000 (+0200) Subject: Use \SensitiveParameterValue as the replacement value in exception handling X-Git-Tag: 6.0.0_Alpha_1~1147^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=7c8c7a2cb3b4d0263a505c55704712a2e0c9ab07;p=GitHub%2FWoltLab%2FWCF.git Use \SensitiveParameterValue as the replacement value in exception handling Use the standard PHP 8.2 replacement value, instead of the `[redacted]` string for consistency. This works as expected, because `SensitiveParameterValue` is polyfilled. --- diff --git a/wcfsetup/install/files/lib/core.functions.php b/wcfsetup/install/files/lib/core.functions.php index ed81b6d393..8190bd7dd0 100644 --- a/wcfsetup/install/files/lib/core.functions.php +++ b/wcfsetup/install/files/lib/core.functions.php @@ -736,8 +736,12 @@ EXPLANATION; $isSensitive = true; } - if ($isSensitive && isset($item['args'][$i])) { - $item['args'][$i] = '[redacted]'; + if ( + $isSensitive + && isset($item['args'][$i]) + && !($item['args'][$i] instanceof \SensitiveParameterValue) + ) { + $item['args'][$i] = new \SensitiveParameterValue($item['args'][$i]); } $i++; } @@ -748,8 +752,12 @@ EXPLANATION; || $item['class'] === 'PDO' ) { if ($item['function'] === '__construct') { - $item['args'] = array_map(function () { - return '[redacted]'; + $item['args'] = array_map(function ($value) { + if (!($value instanceof \SensitiveParameterValue)) { + $value = new \SensitiveParameterValue($value); + } + + return $value; }, $item['args']); } }