Skip to content

Commit

Permalink
Merge branch 'master' into early-profiling
Browse files Browse the repository at this point in the history
  • Loading branch information
cleptric authored Sep 5, 2024
2 parents e0576ce + 383514b commit ae21fbe
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 7 deletions.
7 changes: 4 additions & 3 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@
],
'self_accessor' => false,
'modernize_strpos' => false,
'nullable_type_declaration_for_default_null_value' => [
'use_nullable_type_declaration' => true,
],
'no_superfluous_phpdoc_tags' => [
'allow_mixed' => true,
],
Expand All @@ -33,6 +30,10 @@
'method' => 'multi',
'property' => 'multi',
],
'trailing_comma_in_multiline' => [
'after_heredoc' => false,
'elements' => ['arrays'],
],
])
->setRiskyAllowed(true)
->setFinder(
Expand Down
5 changes: 5 additions & 0 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ parameters:
count: 1
path: src/Options.php

-
message: "#^Method Sentry\\\\Options\\:\\:getHttpSslNativeCa\\(\\) should return bool but returns mixed\\.$#"
count: 1
path: src/Options.php

-
message: "#^Method Sentry\\\\Options\\:\\:getHttpSslVerifyPeer\\(\\) should return bool but returns mixed\\.$#"
count: 1
Expand Down
11 changes: 11 additions & 0 deletions src/HttpClient/HttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,17 @@ public function sendRequest(Request $request, Options $options): Response
curl_setopt($curlHandle, \CURLOPT_SSL_VERIFYPEER, false);
}

$httpSslNativeCa = $options->getHttpSslNativeCa();
if ($httpSslNativeCa) {
if (
\defined('CURLSSLOPT_NATIVE_CA')
&& isset(curl_version()['version'])
&& version_compare(curl_version()['version'], '7.71', '>=')
) {
curl_setopt($curlHandle, \CURLOPT_SSL_OPTIONS, \CURLSSLOPT_NATIVE_CA);
}
}

$httpProxy = $options->getHttpProxy();
if ($httpProxy !== null) {
curl_setopt($curlHandle, \CURLOPT_PROXY, $httpProxy);
Expand Down
5 changes: 3 additions & 2 deletions src/Logger/DebugFileLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ public function __construct(string $filePath)
}

/**
* @param mixed $level
* @param mixed[] $context
* @param mixed $level
* @param string|\Stringable $message
* @param mixed[] $context
*/
public function log($level, $message, array $context = []): void
{
Expand Down
5 changes: 3 additions & 2 deletions src/Logger/DebugStdOutLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
class DebugStdOutLogger extends AbstractLogger
{
/**
* @param mixed $level
* @param mixed[] $context
* @param mixed $level
* @param string|\Stringable $message
* @param mixed[] $context
*/
public function log($level, $message, array $context = []): void
{
Expand Down
15 changes: 15 additions & 0 deletions src/Options.php
Original file line number Diff line number Diff line change
Expand Up @@ -942,6 +942,20 @@ public function setHttpSslVerifyPeer(bool $httpSslVerifyPeer): self
return $this;
}

public function getHttpSslNativeCa(): bool
{
return $this->options['http_ssl_native_ca'];
}

public function setHttpSslNativeCa(bool $httpSslNativeCa): self
{
$options = array_merge($this->options, ['http_ssl_native_ca' => $httpSslNativeCa]);

$this->options = $this->resolver->resolve($options);

return $this;
}

/**
* Returns whether the requests should be compressed using GZIP or not.
*/
Expand Down Expand Up @@ -1139,6 +1153,7 @@ private function configureOptions(OptionsResolver $resolver): void
'http_connect_timeout' => self::DEFAULT_HTTP_CONNECT_TIMEOUT,
'http_timeout' => self::DEFAULT_HTTP_TIMEOUT,
'http_ssl_verify_peer' => true,
'http_ssl_native_ca' => false,
'http_compression' => true,
'capture_silenced_errors' => false,
'max_request_body_size' => 'medium',
Expand Down
7 changes: 7 additions & 0 deletions tests/OptionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,13 @@ static function (): void {},
'setHttpSslVerifyPeer',
];

yield [
'http_ssl_native_ca',
true,
'getHttpSslNativeCa',
'setHttpSslNativeCa',
];

yield [
'http_compression',
false,
Expand Down

0 comments on commit ae21fbe

Please sign in to comment.