Problem/Motivation
I noticed this after the fact when I posted the patch to add the targeted cache control settings in #3245475: Add support for targeted cache-control headers, but the element validation handler is attached to an unused array key:
$form['targeted']['items_wrapper']['items']['#element_validate'][] = '_http_cache_control_targeted_items_validate';
Should be:
$form['targeted_cache_control']['items_wrapper']['items']['#element_validate'][] = '_http_cache_control_targeted_items_validate';
The current code results in the _http_cache_control_targeted_items_validate callback being passed an empty element, so it attempts to loop over an empty array, resulting in validation always passing.
Proposed resolution
Update the "targeted" key used to set that validation callback to "targeted_cache_control"
Remaining tasks
Apply the change, and confirm that the validation code functions as expected.
Issue fork http_cache_control-3565435
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
bburgFor some reason I'm drawing a blank on where to open the merge request to the 2.x branch at the moment. Here's the comparison.
Edit: Didn't realize I wasn't signed into GitLab.
Comment #4
dieterholvoet commentedThanks, didn't catch that one. Validation did trigger before, but never with any values. Will create a new release with the fix.
Comment #6
dieterholvoet commented