Closed (fixed)
Project:
Drupal core
Version:
4.6.4
Component:
base system
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
1 Dec 2005 at 04:26 UTC
Updated:
4 Feb 2006 at 08:01 UTC
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));
}
Comments
Comment #1
enderai commentedI 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...)
Comment #2
enderai commentedOk, 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:
Don't know what happened...
Comment #3
dopry commentedchecked the patch, this is fixed.
Comment #4
(not verified) commented