Here is the validation image_effect_color function.
We can see that $hex_value is clearly unused, and so preg_replace function is not used for anything.

/**
 * Element validate handler to ensure a hexadecimal color value.
 */
function image_effect_color_validate($element, &$form_state) {
  if ($element['#value'] != '') {
    $hex_value = preg_replace('/^#/', '', $element['#value']);
    if (!preg_match('/^#[0-9A-F]{3}([0-9A-F]{3})?$/', $element['#value'])) {
      form_error($element, t('!name must be a hexadecimal color value.', array('!name' => $element['#title'])));
    }
  }
}
CommentFileSizeAuthor
#1 1090464.patch916 bytesHaza
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Haza’s picture

Status: Active » Needs review
FileSize
916 bytes

Here is a little patch, let see what the test bot think about that.

Artusamak’s picture

Status: Needs review » Reviewed & tested by the community
oriol_e9g’s picture

Status: Reviewed & tested by the community » Needs review

head:

if ($element['#value'] != '') {...

patch:

if (empty($element['#value']){...

should not be reversed?

if (!empty($element['#value']){...