Closed (fixed)
Project:
SMTP Authentication Support
Version:
8.x-1.4
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
1 Apr 2025 at 10:33 UTC
Updated:
8 Apr 2026 at 10:06 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
mdsohaib4242 commentedComment #2
mdsohaib4242 commentedComment #3
mdsohaib4242 commentedComment #4
mdsohaib4242 commentedComment #5
gfbarbosa commentedThe module currently calls
explode(',', $to)without checking if$tois null or a valid string. This triggers a deprecation warning in PHP 8.1 and above.Reference:
https://www.php.net/manual/en/migration81.deprecated.php
https://stackoverflow.com/questions/71097927/php-8-1-explode-passing-nul...
This patch adds a check to ensure $to is a string or array before calling explode(). It handles the following scenarios:
- If $to is a string: it uses explode(',', $to)
- If $to is an array: it uses it directly
- If $to is null or empty: it skips the recipient loop
This prevents the deprecation warning and maintains compatibility with PHP 8.1+ and future versions.
Comment #6
tame4tex commented@gfbarbosa thank you for the patch!
Are you able to contribute the patch as commits to the 3516633-deprecated-function-explode branch on the Issue Fork for this issue and then create a Merge Request? I would then be happy to review.
Here is more info on how to contribute to issues via Issue Forks and Merge Requests:
https://www.drupal.org/docs/develop/git/using-gitlab-to-contribute-to-dr...
https://www.drupal.org/docs/develop/git/using-gitlab-to-contribute-to-dr...
Comment #9
bluegeek9 commentedI made a simpler MR. According to hook_mail_alter $message['to'] is a string. The error message only mentions NULL. I do not think we need to check if $message['to'] is an array.
Comment #10
bluegeek9 commentedComment #14
mdsohaib4242 commented