Deprecated function with php 8.1

Created on 1 December 2022, over 2 years ago
Updated 18 February 2023, about 2 years ago

Problem/Motivation

With PHP 8.1 (not sure if the deprecation dates from 8.1 though), when having a link with a url without parameters in your email template you get the message:
Deprecated function: parse_str(): Passing null to parameter #1 ($string) of type string is deprecated in Drupal\mimemail\Utility\MimeMailFormatHelper::mimeMailUrl()

Steps to reproduce

Create an email with a link to front such as <a href="/">Whatever</a>. It doesn't matter the url of the link actually, only matters that there is no parameters attached ot it (/link?param=whit-param).

Proposed resolution

We just need to check if $query is not empty before using parse_str.

Remaining tasks

None, patch attached.

πŸ› Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡­πŸ‡·Croatia Aporie

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024