Drupal's update.php script redirecting to homepage and not updating

While upgrading a couple of different Drupal (5.x) sites, I ran into an annoying issue where the update.php script just redirected to the sites homepage after the "Select Version" page. The server in question has PHP's mod_security enabled which has caused some problems with other sites in the past, so I think it's related to that, but I'm not totally sure.

Any way, the fix is to add the following line of code to your update.php script before line 794

if ($_POST['op']) $_REQUEST['op'] = $_POST['op'];

The finished product should look something like:

update_fix_schema_version();
update_fix_watchdog_115();
update_fix_watchdog();
update_fix_sessions();

//start new code
if ($_POST['op']) $_REQUEST['op'] = $_POST['op'];
//end new code

$op = isset($_REQUEST['op']) ? $_REQUEST['op'] : '';
switch ($op) {
        case 'Update':
                $output = update_update_page();
                break;

Have you had the same problem? Do you know what is causing it? Did the above code work for you?

Trackback URL for this post:

http://www.schoonzie.com/trackback/20

Comments

wqw's picture

Found two good games Dollar

Found two good games Dollar (wow gold) deal! (wow gold) Are cheap! Blue is very good, you may wish to enter the site to its own needs of the trading game coin! (wow gold) Is also available in Dailian game! (wow power leveling)This station is also available wow power levelingwow powerleveling wow power leveling buy rolexof World of Warcraft gold

Post new comment

The content of this field is kept private and will not be shown publicly.
If you have a Gravatar account, used to display your avatar.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

Drupal Association: Individual Member Google Qualified Individual