Describe the bug
We have a module name containing _deploy and in the .module file we have various Drupal hooks (eg. hook_form_FORM_ID_alter). After upgrading to Drupal 10.3, Drush 12.5.3 is calling these hooks because our module name or hook name. Drush deploy is then failing with this error:
> [notice] Deploy hook started: woot_deploy_form_node_page_edit_form_alter
> [notice] Performed: woot_deploy_form_node_page_edit_form_alter
> [notice] Deploy hook started: woot_deploy_form_node_page_form_alter
> [error] ArgumentCountError: Too few arguments to function woot_deploy_form_node_page_form_alter(), 1 passed in /vendor/drush/drush/src/Commands/core/DeployHookCommands.php on line 187 and exactly 3 expected in woot_deploy_form_node_page_form_alter() (line 79 of /docroot/modules/custom/woot_deploy/woot_deploy.module) #0 /vendor/drush/drush/src/Commands/core/DeployHookCommands.php(187): woot_deploy_form_node_page_form_alter(Array)
To Reproduce
Have a module including _deploy at the end of the name and add any Drupal hook to the .module file. eg:
function woot_deploy_form_node_page_edit_form_alter(&$form, FormStateInterface &$form_state, $form_id) {
Do stuff here;
}
Expected behavior
Don't run/call non-deploy hooks.
Actual behavior
hook_form_FORM_ID_alter is being run as a deploy hook.
Workaround
If all arguments have default values and we add check code, Drush deploy likely won't fail, but I didn't get that far with it.
Alternatively moving the Drupal hooks to a module with a name that doesn't include _deploy works.
System Configuration
| Q |
A |
| Drush version? |
12.5.3 |
| Drupal version? |
10.3.8 |
| PHP version |
8.2.22 |
| OS? |
Linux |
Additional information
Related to #5216
Describe the bug
We have a module name containing
_deployand in the .module file we have various Drupal hooks (eg.hook_form_FORM_ID_alter). After upgrading to Drupal 10.3, Drush 12.5.3 is calling these hooks because our module name or hook name. Drush deploy is then failing with this error:To Reproduce
Have a module including
_deployat the end of the name and add any Drupal hook to the.modulefile. eg:Expected behavior
Don't run/call non-deploy hooks.
Actual behavior
hook_form_FORM_ID_alter is being run as a deploy hook.
Workaround
If all arguments have default values and we add check code, Drush deploy likely won't fail, but I didn't get that far with it.
Alternatively moving the Drupal hooks to a module with a name that doesn't include
_deployworks.System Configuration
Additional information
Related to #5216