Skip to content

Commit

Permalink
Merge branch '4.4' into 5.4
Browse files Browse the repository at this point in the history
* 4.4:
  [HttpClient] Fix the CS fix
  Workaround disabled "var_dump"
  [Serializer] Respect default context in DateTimeNormalizer::denormalize

# Conflicts:
#	src/Symfony/Component/Debug/ErrorHandler.php
#	src/Symfony/Component/HttpClient/HttpClientTrait.php
#	src/Symfony/Component/HttpKernel/EventListener/DebugHandlersListener.php
  • Loading branch information
ogizanagi committed Jul 28, 2022
2 parents 6260d3b + 9006324 commit 5c5c37e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions HttpClientTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ private static function prepareRequest(?string $method, ?string $url, array $opt
}

// Validate on_progress
if (!\is_callable($onProgress = $options['on_progress'] ?? 'var_dump')) {
if (isset($options['on_progress']) && !\is_callable($onProgress = $options['on_progress'])) {
throw new InvalidArgumentException(sprintf('Option "on_progress" must be callable, "%s" given.', get_debug_type($onProgress)));
}

Expand Down Expand Up @@ -206,9 +206,11 @@ private static function mergeDefaultOptions(array $options, array $defaultOption

$options += $defaultOptions;

foreach (self::$emptyDefaults ?? [] as $k => $v) {
if (!isset($options[$k])) {
$options[$k] = $v;
if (isset(self::$emptyDefaults)) {
foreach (self::$emptyDefaults as $k => $v) {
if (!isset($options[$k])) {
$options[$k] = $v;
}
}
}

Expand Down

0 comments on commit 5c5c37e

Please sign in to comment.