Calling drush commands produces The following Php errors:
PHP Fatal error: Declaration of Drupal\field_validation\Form\FieldValidationRuleAddForm::buildForm(array $form, Drupal\Core\Form\FormStateInterface $form_state, ?Drupal\field_validation\FieldValidationRuleSetInterface $field_validation_rule_set = NULL, $field_validation_rule = NULL) must be compatible with Drupal\field_validation\Form\FieldValidationRuleFormBase::buildForm(array $form, Drupal\Core\Form\FormStateInterface $form_state, ?Drupal\field_validation\FieldValidationRuleSetInterface $field_validation_rule_set = NULL, $field_validation_rule = NULL, $field_name = '') in [REDACTED]/modules/contrib/field_validation/src/Form/FieldValidationRuleAddForm.php on line 18
Drush command terminated abnormally due to an unrecoverable error. [error]
Error: Declaration of Drupal\field_validation\Form\FieldValidationRuleAddForm::buildForm(array $form, Drupal\Core\Form\FormStateInterface $form_state, ?Drupal\field_validation\FieldValidationRuleSetInterface $field_validation_rule_set = NULL, $field_validation_rule = NULL) must be compatible with
Drupal\field_validation\Form\FieldValidationRuleFormBase::buildForm(array $form, Drupal\Core\Form\FormStateInterface $form_state, ?Drupal\field_validation\FieldValidationRuleSetInterface $field_validation_rule_set = NULL, $field_validation_rule = NULL, $field_name = '') in
[REDACTED]/modules/contrib/field_validation/src/Form/FieldValidationRuleAddForm.php, line 18
The same error also happens in FieldValidationRuleEditForm
Comments
Comment #2
mspae commentedComment #3
Anonymous (not verified) commentedJust tried out the patch last night and I can confirm that it solves the issue.
Comment #4
mikemadison commentedWe started running into this error on one of our environments and the above patch did help with that error. However, we are now getting this (similar) error:
Comment #5
bletch commentedWe ran into the same problem, it is a PHP version issue. This module throws the error when running PHP v 7.2. We went down to v 7.1 and it fixed the issue.
Is there a plan to roll this patch into the current branch, we prefer to be on 7.2 and this is the only module holding that up for us right now.
Comment #6
guietc commentedI prefer to stay in PHP 7.2.
I applied the patch from #2 and it works for me.
Comment #7
mnshantz commentedUsing PHP7.2 as well and the patch from #2 solved the error for me.
Comment #8
das-peter commentedI'd say this is RTBC.
If inheritance is used the child classes should ensure their method signature is compatible with the parents - well before php 7.2 it was considered "should" and just bad style if that wasn't the case - as of php 7.2 it's a "have to" and "you're not allowed to break code by extending" ;).
FieldValidationRuleAddFormandFieldValidationRuleEditFormextendFieldValidationRuleFormBasedefines and hence need to support the same arguments inbuildForm().Regarding #4 the "follow-up" error originates in another module with the same problem running on php 7.2.
Comment #10
g089h515r806 commentedcommited