Problem/Motivation
In PhpMail we have this
$additional_headers = isset($message['Return-Path']) && ($site_mail === $message['Return-Path'] || static::_isShellSafe($message['Return-Path'])) ? '-f' . $message['Return-Path'] : '';
$mail_result = $this->doMail(
$message['to'],
$mail_subject,
$mail_body,
$mail_headers,
$additional_headers
);
And the signature of doMail is this
protected function doMail(string $to, string $subject, string $message, array|string $additional_headers = [], string $additional_params = ''): bool {
So on a cursory read, you would think that $additional_headers is passed to the
$additional_headers
param, but its not, its passed as $additional_params
Steps to reproduce
Read the current code and get confused.
Proposed resolution
Rename the local variable in mail from $additional_headers to $additional_params to match the signature of doMail and avoid the confusion.
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | Param-changed.png | 19.79 KB | urvashi_vora |
Issue fork drupal-3345385
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 10.1.x
changes, plain diff MR !3570
- 3345385-local-variable-additionalheaders
changes, plain diff MR !3569
Comments
Comment #3
larowlanComment #6
cafuego commentedMade a PR with a simple variable rename.
Comment #8
urvashi_vora commentedI will review the MR.
Comment #9
urvashi_vora commentedI reviewed the MR.
Steps performed while reviewing:-
1. Taken clone of issue branch
2. Reviewed PHPMail.php file as per Merge Request 3750.
3. On line number 124 and 130, the param $additional_headers is changed to $additional_params.
4. Attaching the screenshot for reference.
Test Result:- Pass.
Moving it to RTBC.
The MR looks good to me, and it is ready to be merged.
Thanks for the work.
Comment #13
larowlanThanks committed to 10.1.x and backported to 9.5.x to keep things consistent as there's little risk of disruption here
Comment #14
larowlan