Skip to content

Commit

Permalink
Merge pull request #416 from php-http/fix/cache-plugin-directives
Browse files Browse the repository at this point in the history
correctly handle null value for respect_response_cache_directives
  • Loading branch information
dbu authored Apr 29, 2022
2 parents 0e5533d + 9d7aea1 commit a07220d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

The change log describes what is "Added", "Removed", "Changed" or "Fixed" between each release.

# 1.26.1 - 2022-04-29

- Fixed: Setting the cache plugin option `respect_response_cache_directives` to `null` makes the
plugin use the default set of directives instead of triggering an error.

# 1.26.0 - 2022-03-17

- Fixed you can now configure the cache plugin default_ttl with `null`.
Expand Down
2 changes: 1 addition & 1 deletion src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,7 @@ private function createCachePluginNode()
->end()
->end()
->variableNode('respect_response_cache_directives')
->info('A list of cache directives to respect when caching responses')
->info('A list of cache directives to respect when caching responses. Omit or set to null to respect the default set of directives.')
->validate()
->always(function ($v) {
if (is_null($v) || is_array($v)) {
Expand Down
3 changes: 3 additions & 0 deletions src/DependencyInjection/HttplugExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,9 @@ private function configurePluginByName($name, Definition $definition, array $con
switch ($name) {
case 'cache':
$options = $config['config'];
if (\array_key_exists('respect_response_cache_directives', $options) && null === $options['respect_response_cache_directives']) {
unset($options['respect_response_cache_directives']);
}
if (!empty($options['cache_key_generator'])) {
$options['cache_key_generator'] = new Reference($options['cache_key_generator']);
}
Expand Down

0 comments on commit a07220d

Please sign in to comment.