- This topic has 1 reply, 1 voice, and was last updated 5 years ago by
torarnv.
-
AuthorPosts
-
-
January 25, 2017 at 12:51 pm #7751
torarnvMemberI’m using a piklist form with
Logged in: falseto accept registrations for an event. Due to the rush of registration when the event opens, page-caching is used via W3 Total Cache to limit the number of PHP processes that need to be spun up.This presents a problem later on when new registrations are submitted, as
Piklist_Validate::check()tries to fetch the previously rendered form viaget_transient(), which by that time has expired (after 24 hours).The error condition is also hard to detect and work around in user-code, as
Piklist_Form::process_form()just returns if save() returns false, without setting any error state that can be picked up elsewhere.Even if I aggressively invalidate the cache, say every 5 minutes, there’s still a window of 5 minutes where the page cache is valid, but the transient hits its expiry time, in the worst case just after the page cache has been regenerated by a visit.
One fix seems to unconditionally do set_transient(), instead of checking
false === get_transient(piklist::$prefix . $fields_id)first, which would update the transient timeout. As long as the transient timeout is larger than the cache invalidation expiry time, this should ensure the transient is alive for the duration of any cached form. -
January 25, 2017 at 12:53 pm #7752
torarnvMemberTechnically, a transient can also expire before the timeout, at any time, so the form validation may fail regardless of caching, say if the user spends a bit of time filling out the form.
-
-
AuthorPosts
- You must be logged in to reply to this topic.