The code

<?php
       
if ($recaptcha_ajax_api) {
         
// By default CAPTCHA turns off page caching on
          // any page where a CAPTCHA challenge appears.
          // If recaptcha is using AJAX API, set caching
          // back to it's old state as stored in DB.
         
global $conf;
         
$cache = variable_get('cache', FALSE);
         
$conf['cache'] = $cache;
        }
?>

won't reset $conf['cache'] to what is inside the DB as variable_get() uses the global $conf as well. So this will stay FALSE as set by the captcha module even if ajax is used as you write the same value to the variable as it was before.
<?php
function variable_get($name, $default = NULL) {
  global
$conf;
  return isset(
$conf[$name]) ? $conf[$name] : $default;
}
?>

Currently I don't have any idea how we can easily get the original value back except for a custom query. I will so a patch asap if I get a good idea to what to do here.

Comments

Status:Active» Needs review
StatusFileSize
new597 bytes

The only way I found was using a direct query. I kept it as small as possible. But this makes sure we get the setting from the database.

Why WHERE name LIKE 'cache' instead of WHERE name = 'cache'?

We are looking for a string and so I am "used" to use LIKE.

http://dev.mysql.com/doc/refman/5.1/en/string-comparison-functions.html

Per the SQL standard, LIKE performs matching on a per-character basis, thus it can produce results different from the = comparison operator:

As we use a fixed value here that does not demand LIKE we can use = as well and it might be faster by some ms. So choose what you LIKE ;)

Should I reroll the patch to = than?

Please do. Thanks.

StatusFileSize
new594 bytes

New patch version with "="

Version:7.x-1.x-dev» 6.x-1.x-dev
Status:Needs review» Patch (to be ported)
StatusFileSize
new1.37 KB

Fixed in 94ede9404f8e60a561d8c990e64d9b054b47276f. Patch as-committed attached.