This seems like a really fundamental problem, so I'll be surprised if nobody has noticed it before... but it doesn't seem to be listed in the known bugs...

When captcha is enabled for user registration and the drupal cache is disabled, if somebody tries to register they are presented with the image that they must convert to text. If for some reason the image is too difficult to read, they can hit "refresh" and get a new (hopefully easier-to-read) image. Cool.

However, if the drupal cache is enabled, hitting refresh just gives me the same image. If it can not be read, that will effectively prevent somebody from registering at all!

It should be really simple to test... surely it's not just me getting this?

Comments

arnabdotorg’s picture

Status: Active » Closed (won't fix)

From the 4.6 captcha code, here's the HTML that we generate:

url('captcha/image/'.time())

This is a time variable thing, hence a new image will be requested every time, hence htere is no scope of caching. Two possibilities:

1. Drupal is caching above the module level (which, is highly unlikely)
2. You have a proxy cache in between that's serving you old pages.

-Arnab

ymcp’s picture

Hi Arnab,

I used to use a proxy cache built into my (IPCOP) firewall, but found that it often caused problems when doing website development work, so now I always have it disabled.

I have repeated my tests on Windows (IE6 + Firefox 1.5) and Linux (Firefox 1.0.7) & the results are always the same, so it is not browser or machine specific.

Using the original 4.6 captcha module (not my modified one), and with the drupal cache enabled, when I view the user registration screen I always see the same image. Hitting refresh or loading the page in a different browser makes no difference.

Using the "dba" module, I can see that http://www.mysite.com/captcha/image/1139846272 is in the cache. If I view the source HTML of the pages, that is the same image which is included.

If I empty the cache (using the "devel" module), this results in a new image being generated, but then *that* image gets cached.

It seems to me that perhaps the cache module shouldn't be cacheing the captcha images in the first place. Why would you ever want to display the same generated image twice? Is there some code that can be added to the captcha module to ensure that the image is not cached by drupal?

One work-around to an unreadable captcha image is to enter an incorrect text string in the "word" field. This results in an error message and a freshly generated image. However, just hitting "refresh" does not work if the drupal cache is enabled. This could be quite confusing for users.

Please can somebody repeat this simple test & see what happens? Note: this "bug" will probably only occur for captchas presented to non-logged-in users because logged-in users always bypass the drupal cache anyway.

ymcp’s picture

Title: serious problem with drupal cache » disable drupal cache for specific modules

It turns out that this has been discussed before... unfortunately it seems to require a (small) change to the core bootstrap.inc file, as well as to each module that you don't want to cache.

Any chance that this will get added to drupal core?

arnabdotorg’s picture

Can you please confirm that you're getting

http://www.mysite.com/captcha/image/1139846272

EVERY time you refresh? This shouldnt happen. The number at the end should keep changing; which is what i was pointing out in my previous post. If the number isn't changing, then we'll need to think of cache exclusion.

ymcp’s picture

Yes, with the drupal cache enabled, the number /captcha/image/1139846272 never changes.

Well, at least until I empty the cache or enter a text string into the captcha field.

This should be really easy for somebody else to test.

rkn-dupe’s picture

Version: 4.6.x-1.x-dev » 5.x-1.1
Status: Closed (won't fix) » Active

I'm having this problem as well with this module. As the original person said - this seems like a major problem. Is there no answer atm?

rkn-dupe’s picture

I'm curious - is no one else having this problem?

wundo’s picture

Status: Active » Closed (fixed)
phplaw’s picture

Ajax load new captcha image without cache is a way to fix this problem.