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.
If the form cache is not in sync with the page cache, the AuthcacheFormBuildid can not return a new Buildid. The result is that nothing happens when users press the submit button on a form.
This should of course not happen, but we have had this several times while testing, debugging and building test scripts.
Attached patch tries to rebuild a new authcache template form and renames it to the originally requested form_build_id.
Comment | File | Size | Author |
---|---|---|---|
recover_form_cache.patch | 1.83 KB | batje | |
Comments
Comment #1
znerol CreditAttribution: znerol commentedThanks, this is great.
What is the reason behind explicitly including those files when drupal gets bootstrapped after that anyway? Looking at _drupal_bootstrap_full it seems to me that those files should be loaded anyway? Also are you sure that the calls to
module_load_all_includes
andmodule_load_all
really are required before the bootstrap?Comment #2
znerol CreditAttribution: znerol commentedAnd now I remember why I left that bit out for the moment. There is another catch with this approach. Some forms need arguments. In those cases we need to supply the original arguments to drupal_get_form in order to be able to reproduce them completely.
Comment #3
batje CreditAttribution: batje commentedfair point. we didn't have that scenario.
Comment #4
znerol CreditAttribution: znerol commentedI found a way to get around the hard-coded 6h expiration time for
cache_form
entries. I've published a little helper module providing a cache-class capable of intercepting calls tocache_get
,cache_set
andcache_clear
. Whenever one of those functions is called, the hookshook_cacheobject_load
,hook_cacheobject_presave
andhook_cacheobject_clear
get invoked. Implementors then have a chance to mess with the cache-object, i.e. alter the expiry-time etc.When the Cache Object API module is present,
authcache_form
now will expose an option to set the expiry time for form prototypes held in the form cache.Commit: 6142125