Custom validate function not working I'm sure there's some simple reason that my custom validate function isn't executing.

Here's my code:

function MYMODULE_form_message_ui_instance_message_manage_alter(&amp;$form, &amp;$form_state, $form_id) {
  array_unshift($form['#validate'], 'MYMODULE_validate_relationship');
  watchdog("form", "&lt;pre&gt;" . print_r($form, true) . "&lt;/pre&gt;");
}

function MYMODULE_validate_relationship($form, &amp;$form_state) {
  watchdog("validate form state", "&lt;pre&gt;" . print_r($form_state, true) . "&lt;/pre&gt;");
  watchdog("validate form", "&lt;pre&gt;" . print_r($form, true) . "&lt;/pre&gt;");
}


On form submission, the first watchdog - "form" is being exected, however the second and third are not. Why is this? I can't find any information on why a custom validate hook wouldn't execute.

EDIT per Pierre's request:

I am writing a custom validation function that I am trying to execute before the other validation functions. I am doing this using array_unshift. This seems to be working, as my #validate array looks like this:

[#validate] =&gt; Array
    (
        [0] =&gt; MYMODULE_validate_relationship
        [1] =&gt; message_ui_instance_message_manage_validate
        [2] =&gt; message_private_form_message_private_instance_message_manage_validate
    )


However the code in MYMODULE_validate_relationship is never executing.

As far as I can tell, $form and &amp;$form should be irrelevant in the validate function, because once you're at the validation stage, nothing should actually be modifying the form (I think?). And most examples I was seeing did not including passing the $form by reference. And I've tried both ways, and in neither way is the validate hook firing.
The answer is that the submit button was being generated by the actions array item.

Simply changing my form value to this:

$form['actions']['submit']['#validate'][] = 'MYMODULE_validate_relationship';

Correctly allowed it to be executed.

https://api.drupal.org/api/drupal/developer!topics!forms_api_reference.html/7#actions