ok, there are actually two problems here, in function update_fix_access_table in update.php:

  1. this check always fails, b/c $conf is empty at that point:

    if (variable_get('update_access_fixed', FALSE)) {
      return;
    }
  2. variable_set bombs, b/c the call to cache_clear_all in that function is no longer available--it was moved to cache.inc.

it appears that the first bug went unnoticed for awhile, b/c even though the initial check failed, the subsequent code was running w/o creating any errors.

CommentFileSizeAuthor
#2 update_fix_access_bootstrap.patch861 bytesdww
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

hunmonk’s picture

Version: 4.7.2 » x.y.z

whoops. this is only on HEAD, i believe...

dww’s picture

Title: update.php fails -- $conf empty + cache_clear_all missing » update.php fails -- no output on MySQL, $conf empty + cache_clear_all() missing
Assigned: Unassigned » dww
Status: Active » Needs review
FileSize
861 bytes

confirmed: only in HEAD.

the symptom is a totally blank page -- no output, when run on MySQL >= 4.1. unfortunately, i ran into this same bug and debugged it on my own. then i searched the queue and found this issue. ;) whoops.

anyway, indeed, the bug is that update_fix_access_table() is trying to use variable_get() and variable_set(). unfortunately, it's being called before drupal_bootstrap(), so those functions aren't really available. worse yet, when variable_set() attempts to call cache_clear_all(), the script (silently) crashes, since cache.inc hasn't been included yet.

i considered trying to just include cache.inc first, but that still doesn't solve the problem of the variables we're looking at and setting not really being there. so, instead, i moved update_fix_access_table() to *after* the call to drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL).

to confirm that this is safe, i just did the following:

  1. dropped my test DB
  2. edited database.4.1.mysql to comment out the utf8 definition for the {access} table
  3. loaded the modified database.4.1.mysql
  4. created 1st account
  5. ran my patched update.php

given that, the update started producing output again. ;) moreover, after the update ran, i had: update_access_fixed b:1; in my {variable} table. and, best of all, a mysqldump showed me that the {access} table was now utf8.

so, unless i'm missing something truly mysterious about drupal_bootstrap(), my patched version of update.php seems to do all the right things.

chx’s picture

Status: Needs review » Reviewed & tested by the community

Excellent work. Only question was: does the relocated function something which would stop bootstrapping? No, it only converts the access table to UTF-8, so the only possible problem could be that in some very, very unfortunate and arcane case the admin finds himself denied. This is so improbable that RTBC.

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to HEAD. Thanks a bunch!

Anonymous’s picture

Status: Fixed » Closed (fixed)