Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP 8 email line break change #7560

Merged
merged 2 commits into from
Oct 14, 2022

Conversation

sbulen
Copy link
Contributor

@sbulen sbulen commented Oct 12, 2022

Emails were not getting sent properly due to malformed headers under the following circumstances:

  • PHP 8+
  • Unix only (Windows worked OK)
  • Mail type PHP only (SMTP worked OK)

Due to a change in PHP 8, the PHP mail() function now expects line endings to be "\r\n", even on linux systems. The old SMF logic that changed the line endings per the OS was actually breaking things when using the mail type of PHP on linux.

This fix has been tested on all variants of PHP7.4 vs PHP8.1, windows vs linux, PHP vs SMTP.

See forum discussion:
https://www.simplemachines.org/community/index.php?topic=583842.0

See PHP 8 bug report & discussion. Note the bug report was closed w/o action, saying the new behavior is in line with the RFC:
php/php-src#8086

Signed by Shawn Bulen, bulens@pacbell.net
@sbulen sbulen added this to the 2.1.3 milestone Oct 12, 2022
Signed by Shawn Bulen, bulens@pacbel.net
@sbulen
Copy link
Contributor Author

sbulen commented Oct 13, 2022

Opted for a slightly safer solution that only tweaked the behavior for 8x.

7x is left as-is.

Although my tests in 7x were OK, it's possible that some other environments really won't like the crlf going to mail(). E.g., in the php bug report above, some users complained that crlf was translated to crcrlf in their systems, since their envs were performing a lf => crlf conversion, resulting in broken headers... Best to play it safe...

@sbulen
Copy link
Contributor Author

sbulen commented Oct 13, 2022

Thanks, @BrickOzp !

@sbulen sbulen merged commit 0151851 into SimpleMachines:release-2.1 Oct 14, 2022
@pr-triage pr-triage bot added the PR: merged label Oct 14, 2022
@sbulen sbulen deleted the php_8x_email_fix branch October 18, 2022 21:33
smusmanobjects added a commit to wpexpertsio/Post-SMTP that referenced this pull request Mar 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants