Problem/Motivation
rules_action_mail() in modules/system.eval.inc was already fixed for PHP 8's "optional parameter before required parameter" deprecation as of 7.x-2.14 (the $from parameter has no default):
function rules_action_mail($to, $subject, $message, $from, $langcode, $settings, RulesState $state, RulesPlugin $element) {
Applying the cc/bcc support patch from #3390275 (rules-add-cc-and-bcc-support-3390275-6.patch) reintroduces the same deprecation, because it inserts two new required parameters ($cc, $bcc) ahead of $from, while $from keeps a default value carried over from an older version of the function:
function rules_action_mail($to, $cc, $bcc, $subject, $message, $from = NULL, $langcode, $settings, RulesState $state, RulesPlugin $element) {
On an environment where this deprecation is escalated to a fatal (ours converts it to a hard error during Drush bootstrap, since Drush's command-discovery step parses every enabled module's files), this aborts site provisioning entirely as soon as the rules module is present with this patch applied.
Steps to reproduce
- Apply rules-add-cc-and-bcc-support-3390275-6.patch from #3390275 to rules 7.x-2.14.
- Run any drush command that triggers module/hook discovery (e.g. drush cc all) on PHP 8.0+ with deprecations treated as fatal.
- Observe: Optional parameter $from declared before required parameter $langcode is implicitly treated as a required parameter, in modules/system.eval.inc.
Proposed resolution
Drop the now-redundant default value from $from, matching how 7.x-2.14 itself already fixed this function before the cc/bcc patch:
function rules_action_mail($to, $cc, $bcc, $subject, $message, $from, $langcode, $settings, RulesState $state, RulesPlugin $element) {
Patch attached, intended to be applied after rules-add-cc-and-bcc-support-3390275-6.patch.
| Comment | File | Size | Author |
|---|---|---|---|
| rules-3390275-php8-from-param.patch | 720 bytes | ayushmishra206 |
Comments