The current validation for number does not allow for an empty string, because is_numeric('') returns false. I believe the check should be in line with the core Drupal version which allows '' or numeric https://api.drupal.org/api/drupal/includes%21form.inc/function/element_v....

Will post a patch shortly

Current validate method:

function variable_validate_number($variable) {
  if (!is_numeric($variable['value'])) {
    return t('The value is not a number.');
  }
}

New validate method:

function variable_validate_number($variable) {
  if ($variable['value'] != '' && !is_numeric($variable['value'])) {
    return t('The value is not a number.');
  }
}
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

bradyemerson’s picture

Patch of above code change.

Jose Reyero’s picture

Status: Active » Closed (duplicate)