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

Comments

haza’s picture

Status: Active » Needs review
StatusFileSize
new916 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']){...
poker10’s picture

Issue summary: View changes
Status: Needs review » Needs work

Thanks for working on this. Agree with @oriol_e9g, the patch #1 is not correct.

Status: Needs work » Closed (outdated)

Automatically closed because Drupal 7 security and bugfix support has ended as of 5 January 2025. If the issue verifiably applies to later versions, please reopen with details and update the version.