Skip to content

Commit 9d7aea1

Browse files
committed
correctly handle null value for respect_response_cache_directives configuration
1 parent 0e5533d commit 9d7aea1

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

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

5+
# 1.26.1 - 2022-04-29
6+
7+
- Fixed: Setting the cache plugin option `respect_response_cache_directives` to `null` makes the
8+
plugin use the default set of directives instead of triggering an error.
9+
510
# 1.26.0 - 2022-03-17
611

712
- Fixed you can now configure the cache plugin default_ttl with `null`.

src/DependencyInjection/Configuration.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,7 @@ private function createCachePluginNode()
776776
->end()
777777
->end()
778778
->variableNode('respect_response_cache_directives')
779-
->info('A list of cache directives to respect when caching responses')
779+
->info('A list of cache directives to respect when caching responses. Omit or set to null to respect the default set of directives.')
780780
->validate()
781781
->always(function ($v) {
782782
if (is_null($v) || is_array($v)) {

src/DependencyInjection/HttplugExtension.php

+3
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,9 @@ private function configurePluginByName($name, Definition $definition, array $con
198198
switch ($name) {
199199
case 'cache':
200200
$options = $config['config'];
201+
if (\array_key_exists('respect_response_cache_directives', $options) && null === $options['respect_response_cache_directives']) {
202+
unset($options['respect_response_cache_directives']);
203+
}
201204
if (!empty($options['cache_key_generator'])) {
202205
$options['cache_key_generator'] = new Reference($options['cache_key_generator']);
203206
}

0 commit comments

Comments
 (0)