Local variable $additional_headers in PhpMail is confusing, rename to $additional_params

Created on 2 March 2023, about 2 years ago

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

📌 Task
Status

Fixed

Version

9.5

Component
Mail 

Last updated 29 minutes ago

No maintainer
Created by

🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

Live updates comments and jobs are added and updated live.
  • Novice

    It would make a good project for someone who is new to the Drupal contribution process. It's preferred over Newbie.

Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024