Browse Source
fix overwriting original vars when logging
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
pull/32898/head
Arthur Schiwon
3 years ago
No known key found for this signature in database
GPG Key ID: 7424F1874854DF23
2 changed files with
6 additions and
3 deletions
-
lib/private/Log/ExceptionSerializer.php
-
tests/lib/Log/ExceptionSerializerTest.php
|
|
|
@ -208,14 +208,16 @@ class ExceptionSerializer { |
|
|
|
} |
|
|
|
|
|
|
|
private function removeValuesFromArgs($args, $values) { |
|
|
|
foreach ($args as &$arg) { |
|
|
|
$workArgs = []; |
|
|
|
foreach ($args as $arg) { |
|
|
|
if (in_array($arg, $values, true)) { |
|
|
|
$arg = '*** sensitive parameter replaced ***'; |
|
|
|
} elseif (is_array($arg)) { |
|
|
|
$arg = $this->removeValuesFromArgs($arg, $values); |
|
|
|
} |
|
|
|
$workArgs[] = $arg; |
|
|
|
} |
|
|
|
return $args; |
|
|
|
return $workArgs; |
|
|
|
} |
|
|
|
|
|
|
|
private function encodeTrace($trace) { |
|
|
|
|
|
|
|
@ -60,8 +60,9 @@ class ExceptionSerializerTest extends TestCase { |
|
|
|
$secret = ['Secret']; |
|
|
|
$this->emit([&$secret]); |
|
|
|
} catch (\Exception $e) { |
|
|
|
$this->serializer->serializeException($e); |
|
|
|
$serializedData = $this->serializer->serializeException($e); |
|
|
|
$this->assertSame(['Secret'], $secret); |
|
|
|
$this->assertSame('*** sensitive parameters replaced ***', $serializedData['Trace'][0]['args'][0]); |
|
|
|
} |
|
|
|
} |
|
|
|
} |