Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,6 @@ parameters:
count: 1
path: src/Event.php

-
message: "#^Property Sentry\\\\Integration\\\\RequestIntegration\\:\\:\\$options \\(array\\{pii_sanitize_headers\\: array\\<string\\>\\}\\) does not accept array\\.$#"
count: 1
path: src/Integration/RequestIntegration.php

-
message: "#^Parameter \\#2 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#"
count: 1
Expand Down
12 changes: 7 additions & 5 deletions src/Integration/RequestIntegration.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@
use Sentry\Event;
use Sentry\Exception\JsonException;
use Sentry\Options;
use Sentry\OptionsResolver;
use Sentry\SentrySdk;
use Sentry\State\Scope;
use Sentry\UserDataBag;
use Sentry\Util\JSON;
use Symfony\Component\OptionsResolver\Options as SymfonyOptions;
use Symfony\Component\OptionsResolver\OptionsResolver;

/**
* This integration collects information from the request and attaches them to
Expand Down Expand Up @@ -93,7 +92,10 @@ public function __construct(?RequestFetcherInterface $requestFetcher = null, arr
$this->configureOptions($resolver);

$this->requestFetcher = $requestFetcher ?? new RequestFetcher();
$this->options = $resolver->resolve($options);

/** @var array{pii_sanitize_headers: string[]} $resolvedOptions */
$resolvedOptions = $resolver->resolve($options);
$this->options = $resolvedOptions;
}

/**
Expand Down Expand Up @@ -303,10 +305,10 @@ private function isRequestBodySizeWithinReadBounds(int $requestBodySize, string
*/
private function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefault('pii_sanitize_headers', self::DEFAULT_SENSITIVE_HEADERS);
$resolver->setAllowedTypes('pii_sanitize_headers', 'string[]');
$resolver->setNormalizer('pii_sanitize_headers', static function (SymfonyOptions $options, array $value): array {
$resolver->setNormalizer('pii_sanitize_headers', static function (array $value): array {
return array_map('strtolower', $value);
});
$resolver->setDefault('pii_sanitize_headers', self::DEFAULT_SENSITIVE_HEADERS);
}
}
Loading
Loading