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
parent
commit
891c10d09d
No known key found for this signature in database GPG Key ID: 7424F1874854DF23
  1. 6
      lib/private/Log/ExceptionSerializer.php
  2. 3
      tests/lib/Log/ExceptionSerializerTest.php

6
lib/private/Log/ExceptionSerializer.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) {

3
tests/lib/Log/ExceptionSerializerTest.php

@ -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]);
}
}
}
Loading…
Cancel
Save