Taken from IRC:
Hello need some help with an issue I am looking at. I am trying to figure out how install.php works. and here I see something I do not understand. Drupal 7-dev HEAD.
In install.php line 311 you will find $form['advanced_options']['db_prefix'] = array(
now if I am right the variable name will be db_prefix. while in line 348 it is being validated: if (!empty($database['prefix'])how can form variable names change ? Is this something I do not know? I am not sure.

Now Heine and Berdir also think this is a bug.
Here are the full codes as were referred above:
insall.php lines 309 - 317:

    // Table prefix
    $db_prefix = ($profile == 'default') ? 'drupal_' : $profile . '_';
    $form['advanced_options']['db_prefix'] = array(
      '#type' => 'textfield',
      '#title' => st('Table prefix'),
      '#default_value' => '',
      '#size' => 45,
      '#description' => st('If more than one application will be sharing this database, enter a table prefix such as %prefix for your @drupal site here.', array('@drupal' => drupal_install_profile_name(), '%prefix' => $db_prefix)),
    );

install.php, lines 348 - 350 Iinside validate helper):

  if (!empty($database['prefix']) && is_string($database['prefix']) && !preg_match('/^[A-Za-z0-9_.]+$/', $database['dprefix'])) {
    form_set_error('db_prefix', st('The database table prefix you have entered, %db_prefix, is invalid. The table prefix can only contain alphanumeric characters, periods, or underscores.', array('%db_prefix' => $db_prefix)), 'error');
  }

I will submit a patch if you think this is actually a bug. I am still too novice to tell that :P

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

chx’s picture

I confirm this as a bug. Observe that the if uses prefix and dbprefix too both are wrong, they should be db_prefix.

brainless’s picture

Title: Wrong variable name being passed to validate hook » Wrong array key name being passed to validate hook

Just checked with D6. The function has been heavily changed (at least from the parameters point of view) and in doing so the parameters went wrong. D6 is all fine.

brainless’s picture

Title: Wrong array key name being passed to validate hook » Wrong array key name being used in validate helper
brainless’s picture

brainless’s picture

Status: Active » Needs review
Dries’s picture

Committed to CVS HEAD. We need tests for the installer. ;-)

Dries’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.