I just discovered a nasty bug introduced in #390856: Do a proper page/code split of project. The project_release_node_form_validate() validation callback for the release node form is not getting called since it lives in an include file. I thought that hook_form() would be getting invoked, which loads the include file that this validation callback lives in. But, apparently that's not the case (presumably because the form is already built and cached). So, the validation callback is just silently ignored. Evil.

I could move the (large) function back into project_release.module, but I'd rather find a more sane way to deal with this. I'll check with chx in IRC and see what we can come up with...

CommentFileSizeAuthor
#2 539182-2.release_node_validation.patch1.73 KBdww

Comments

chx’s picture

See this is why it's so bad to babysit broken code:

    if (function_exists($form_id .'_validate')) {
      $form['#validate'] = array($form_id .'_validate');
    }

I would wager a big bet that's there since 2005 fall.

dww’s picture

Status: Active » Needs review
StatusFileSize
new1.73 KB

@chx: That's not the problem. The real problem in form.inc is in form_execute_handlers(). I'll open a separate core bug about that.

Anyway, seems like the only good way to do this is to put a stub in project_release.module and then include the .inc and invoke the real validate handler from there...

dww’s picture

dww’s picture

Status: Needs review » Fixed

After a bit more testing, committed #2 to HEAD.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.