There is a bug in one of the newly-released Drupal 4.6.3 -> 4.6.4 patches that breaks form_textarea().

Specifically, in the portion of http://drupal.org/files/sa-2005-007/4.6.3.patch which patches common.inc, there is the following:

@@ -1272,7 +1228,7 @@
     }
   }
 
-  return theme('form_element', $title, $pre .'<textarea wrap="virtual"'. $cols .' rows="'. $rows .'" name="edit['. $name .']" id="edit-'. $name .'" class="'. _form_get_class('textarea', $required, _form_get_error($name)) .'"'. drupal_attributes($attributes) .'>'. check_plain($value) .'</textarea>'. $post, $description, 'edit-'. $name, $required, _form_get_error($name));
+  return theme('form_element', $title, $pre .'<textarea wrap="virtual"'. check_plain($cols) .' rows="'. check_plain($rows) .'" name="edit['. $name .']" id="edit-'. $name .'" class="'. _form_get_class('textarea', $required, _form_get_error($name)) .'"'. drupal_attributes($attributes) .'>'. check_plain($value) .'</textarea>'. $post, $description, 'edit-'. $name, $required, _form_get_error($name));
 }
 
 /**

Unfortunately, the use of check_plain($cols) breaks the column specification for the HTML textarea tag; it ends up being rendered in the HTML source as cols=&qt;65&qt; which doesn't render with the desired column width.

A solution that fixes the bug while preserving the check_plain() call is to have it get invoked when $col is first assembled, as follows:

function form_textarea($title, $name, $value, $cols, $rows, $description = NULL, $attributes = NULL, $required = FALSE) {
  $cols = $cols ? ' cols="'. check_plain($cols) .'"' : '';
  $pre = '';
  $post = '';

  // optionally plug in a WYSIWYG editor
  foreach (module_list() as $module_name) {
    if (module_hook($module_name, 'textarea')) {
      $pre  .= module_invoke($module_name, 'textarea', 'pre', $name);
      $post .= module_invoke($module_name, 'textarea', 'post', $name);
    }
  }

  return theme('form_element', $title, $pre .'<textarea wrap="virtual"'. $cols .' rows="'. check_plain($rows) .'" name="edit['. $name .']" id="edit-'. $name .'" class="'. _form_get_class('textarea', $required, _form_get_error($name)) .'"'. drupal_attributes($attributes) .'>'. check_plain($value) .'</textarea>'. $post, $description, 'edit-'. $name, $required, _form_get_error($name));
}

--R.J.
http://www.electric-escape.net/

Comments

enderai’s picture

Title: Drupal 4.6.4 patch breaks form_textarea » Drupal 4.6.4 breaks form_textarea
Version: 4.6.3 » 4.6.4
Status: Needs review » Active

I can confirm that this also happens with a fresh 4.6.4 install. Note that this makes textareas completely unusable in Safari. (Firefox seems to be ok...)

enderai’s picture

Title: Drupal 4.6.4 breaks form_textarea » Drupal 4.6.4 breaks form_textarea (patch and early-released version)

Ok, now I don't know what to think. The 4.6.4 tarball available from the announcement post WAS different than the one available from the project page. the new tarball doesn't have this $cols checking code that breaks the later check_plain() call:

  $cols = $cols ? ' cols="'. $cols .'"' : '';

Don't know what happened...

dopry’s picture

Status: Active » Fixed

checked the patch, this is fixed.

Anonymous’s picture

Status: Fixed » Closed (fixed)