Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: fun4us on January 29, 2023, 02:16:19 PM

Title: SMF 2.0.19 and php 8.1 issue
Post by: fun4us on January 29, 2023, 02:16:19 PM
Hallo,

i have a problem sending notifications emails from smf. Parts of the header become email recipients. I had this in other software also. After changing the code there it worked. Exactly the same forum installation using php 7.4, No problem at all.

Any idea what part of code i have to change?

Kind regards
Title: Re: SMF 2.0.19 and php 8.1 issue
Post by: @rjen on January 29, 2023, 02:42:39 PM
SMF 2.0.19 is not compatible with php 8.1.

Highest supported version is 8.0
Title: Re: SMF 2.0.19 and php 8.1 issue
Post by: shawnb61 on January 29, 2023, 02:52:15 PM
Note also that even php 8.0 has some issues with php email on linux.  Windows us ok, smtp is ok:
https://github.com/SimpleMachines/SMF/pull/7560
Title: Re: SMF 2.0.19 and php 8.1 issue
Post by: fun4us on January 29, 2023, 03:21:48 PM
SMF 2.1.3 also seems not to be compatible because i tried to use Subs-Post.php from 2.1.3 with the same result.
Title: Re: SMF 2.0.19 and php 8.1 and php 8.0 issue
Post by: fun4us on January 29, 2023, 04:46:54 PM
I swtched back tp php8.0-fpm same Error. Switched back to php7.4-fpm ist works.

php8.0 and 8.1 can send emails without problems. Here some testcode:

<?php
  $msg = "Some text";
  $mailaddress = "[email protected]";     
  $header[] = 'MIME-Version: 1.0';
   $header[] = 'Content-type: text/plain; charset=utf-8';
   $header[] = 'To: '.$mailaddress;
   $header[] = 'From: [email protected]';
   $date = date("l dS of F Y h:i:s A");
   $subject="My message for you";
   $message="\r\n" . $msg . "\r\n" . $date;
   mail ($mailaddress, $subject, $message, implode("\r\n", $header));
?>
Title: Re: SMF 2.0.19 and php 8.1 issue
Post by: Kindred on January 29, 2023, 07:09:00 PM
You can not use bits and pieces from one version in an older version
Title: Re: SMF 2.0.19 and php 8.1 issue
Post by: fun4us on January 30, 2023, 07:01:56 AM
I know normally not. I compared the code before and there are only small changes compared to 2.0.19. And the function calls seem to be the same.

2.0.19 does not work on Unix with php 8 and 8+ and it looks like the same Problem can be at 2.1.3 an php 8 and 8+.

Thx @ all
Title: Re: SMF 2.0.19 and php 8.1 issue
Post by: shawnb61 on January 30, 2023, 10:19:52 AM
2.1.3 works fine with php8 & php8.1, using both php & smtp.