Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
views_ui_ajax_form() checks $view->form_cache['key']
to decide wether the form cache should be invalidated. Unfortunately, when retrieving the top item from the stack, the variable $key
that stores the form key gets overwritten with the stack index.
This breaks the subsequent key check: when a string key is compared to an integer key, the string gets implicitely converted to an integer prior to the comparison. Given $view->form_cache['key'] = 'test'
and $key = 0
, the condition $view->form_cache['key'] != $key
evaluates to false, skipping the form cache invalidation.
Proposed solution:
- Do not reuse $key when pulling from the stack.
- Use a type comparison when checking the form key
Comment | File | Size | Author |
---|---|---|---|
#6 | views-form_cache_key_check-2716593-6.patch | 1.06 KB | ciss |
|
Comments
Comment #2
ciss CreditAttribution: ciss as a volunteer commentedIt looks like this bug is also present in Drupal 8: http://cgit.drupalcode.org/drupal/tree/core/modules/views_ui/src/Form/Aj...
Comment #3
ciss CreditAttribution: ciss as a volunteer commentedComment #4
Chris Matthews CreditAttribution: Chris Matthews as a volunteer commentedThe 3 year old patch in #3 to admin.inc does not apply to the latest views 7.x-3.x-dev and if still relevant needs to be rerolled.
Comment #5
ciss CreditAttribution: ciss as a volunteer commented@Chris2 Why did you hide the patch file? If you don't have your automated patch checks under control then please refrain from spamming issues.
Comment #6
ciss CreditAttribution: ciss as a volunteer commentedRerolled against 2ae973e (2019-01-14).
Comment #7
Chris Matthews CreditAttribution: Chris Matthews as a volunteer commentedHi Fabian, I hide the patch file in #3 because it did not apply to the latest views 7.x-3.x-dev and therefore needs to be rerolled into a new patch file. Is that not correct? I wasn't spamming, just attempting to revive some older views issues but please let me know if I've done something wrong.
Comment #8
ciss CreditAttribution: ciss as a volunteer commented@Chris2 Please don't hide any patches at all, because:
Comment #9
Chris Matthews CreditAttribution: Chris Matthews as a volunteer commentedThank you for the help and clarification, understood!