Closed (fixed)
Project:
Project issue tracking
Version:
4.7.x-1.x-dev
Component:
Issues
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
2 Apr 2006 at 11:00 UTC
Updated:
27 Apr 2008 at 02:42 UTC
project_issue_node_form_validate() is currently attempting to modify $form_values, which is apparently a big no-no from inside a FAPI validate() hook. according to gatsby on the #drupal IRC:
|gatsby|: dww: You are not actually supposed to modify anything in _validate regardless of that patch - You can do so only with #refs. It's like a maxim
here's the problem code:
function project_issue_node_form_validate($form_id, $form) {
global $form_values;
...
if ($form_values['pid'] && $project = node_load($form_values['pid'])) {
$node->title = $form_values['title'];
if ($releases = project_release_load($project)) {
if (!$form_values['rid'] || !$releases[$form_values['rid']]) {
$form_values['rid'] = $project->version;
}
empty($form_values['rid']) and form_set_error('rid', t('You have to specify a valid version.'));
}
if ($form_values['component'] && !in_array($form_values['component'], $project->components)) {
$form_values['component'] = 0;
}
...
$file = file_check_upload('file_issue');
$form_values['file'] = file_save_upload($file);
...
}
as soon as #56921 is committed, project will break unless we fix this. sadly, i don't have time to roll a patch right now. i hope someone else can take care of this soon.
thanks,
-derek
Comments
Comment #1
dwwby the way, i'm pretty sure the 2nd hunk of code in there:
$file = file_check_upload('file_issue');$form_values['file'] = file_save_upload($file);
?>
is what's responsible for #55984 "Can't attach patch to initial issue post"...
Comment #2
dwwwhoops, the code i was trying to include got left out (damn preview not working!). i'm talking about file_check_upload():
Comment #3
dwwit appears that the patch to form.inc discussed in #56921 has been reverted and won't be applied on drupal.org. so, the crisis for this issue has passed (which is why i'm downgrading this to normal). however, it's still probably a bad idea to be changing $form_values from inside validate() without using #ref, so i'm leaving this active.
Comment #4
aclight commentedI looked through both project_issue.module and issue.inc and it doesn't look like we're still doing anything evil to $form_values. So I'm marking this one fixed (and moving to the right queue).
Comment #5
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.