Warning: htmlspecialchars(): Passing null to parameter #1

Created on 10 February 2023, over 1 year ago

Problem/Motivation

The warning is generated by the following code in Maillog.php file when running on PHP 8.1:

      $output = $this->t('A mail has been sent: <br/> [Subject] => @subject <br/> [From] => @from <br/> [To] => @to <br/> [Reply-To] => @reply <br/> <pre>  [Header] => @header <br/> [Body] => @body </pre>', [
        '@subject' => $message['subject'],
        '@from' => $message['from'],
        '@to' => $message['to'],
        '@reply' => isset($message['reply_to']) ? $message['reply_to'] : NULL,
        '@header' => $header_output,
        '@body' => $message['body'],
      ]);
      \Drupal::messenger()->addStatus($output, TRUE);

Proposed resolution

Replace NULL by an empty string:

        '@reply' => isset($message['reply_to']) ? $message['reply_to'] : '',
πŸ› Bug report
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡«πŸ‡·France mably

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024