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.

Command icon 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

bburg created an issue. See original summary.

bburg’s picture

For 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.

dieterholvoet’s picture

Status: Active » Reviewed & tested by the community

Thanks, didn't catch that one. Validation did trigger before, but never with any values. Will create a new release with the fix.

  • bburg committed c633754f on 8.x-2.x
    Issue #3565435 by bburg: Targeted cache control form config isn't...
dieterholvoet’s picture

Status: Reviewed & tested by the community » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.