Active
Project:
BOTCHA Spam Prevention
Version:
7.x-1.x-dev
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
30 Mar 2012 at 21:07 UTC
Updated:
28 Apr 2018 at 15:32 UTC
Jump to comment: Most recent
Comments
Comment #1
iva2k commentedAfter some digging I found that D7 ignores global $conf['cache'] for forms. Looks like the way CAPTCHA works relies on #process hook that gets called for cached forms. It cannot be used in BOTCHA as we need to rebuild more than one element and add JS and CSS.
I found a fix - it turns out to be very simple - set $form_state['no_cache'] = TRUE and all works again. I'm also removing $conf['cache'] = 0 bit and all notes pertaining to performance and caching.
It's not back-portable to D6 as 'no_cache' is new to D7.
Comment #3
tomogden commented@iva2k, what happens to a BOTCHA form when it is cached? It's a concern because of the deleterious effect the $form_state['no_cache'] boolean has on AJAX (see issue #1270986: Make BOTCHA work with AJAX).
Thanks for your help.
Comment #4
iva2k commentedBOTCHA uses active protection, and it makes every served form unique (even if its the "same" form). Therefore caching is not allowed. If caching would be allowed, none of the BOTCHA protected forms will ever pass validation.
Comment #5
adam.weingarten commentedI've been researching a conflict between botcha and feedback and I isolated the issue back to this particular patch. Feedback uses the built in AJAX api. When an ajax post happens it gets checked against the form-cache. If the form is not in the form cache an exception is thrown. Setting $form_state['no_cache'] = null seems to fix the issue in the forms/ajax situation (I'm sure it opens a whole new can of worms.). I'm guessing that some of the other AJAX issues people are seeing might be related to this as well. I'm still getting up to speed on this issue. Thinking of maybe making some conditional code to handle the ajax situation?
Comment #6
adam.weingarten commentedComment #7
oadaeh commentedSetting
$form_state['no_cache']toNULLis effectively the same as setting it toFALSE, because the checks against'no_cache'in form.inc are onlyif (empty($form_state['no_cache'])), which means the form WILL be cached, so that is not a valid solution.Comment #8
oadaeh commented