New PHP8.2 error (Swift Mailer 5)

16 posts by 4 authors in: Forums > CMS Builder
Last Post: October 6   (RSS)

By zaba - March 2, 2023

Just checked and...

Swift Mailer will stop being maintained at the end of November 2021.

Please, move to Symfony Mailer at your earliest convenience. Symfony Mailer is the next evolution of Swift Mailer. It provides the same features with support for modern PHP code and support for third-party providers.

this is the current issue I am facing....

I have encountered an error with PHP8.2 and Swiftmailer

#7122 - E_DEPRECATED: strtolower(): Passing null to parameter #1 ($string) of type string is deprecated
/XXXXX/public_html/cmsb/3rdParty/SwiftMailer5/classes/Swift/Transport/Esmtp/AuthHandler.php (line 251)

By Dave - March 2, 2023 - edited: March 2, 2023

Hi Zaba, 

Thanks for the report.  You can try hiding that deprecated error by adding a @ before strtolower as follows: 

/cmsb/3rdParty/SwiftMailer5/classes/Swift/Transport/Esmtp/AuthHandler.php (line 251)

        if (!$mode = @strtolower($this->_auth_mode ?? '')) {

Deprecated errors just mean the feature may be removed in the future.  

The mailer is due to be upgraded sometime soon, Symfony Mailer requires a lot of dependencies (many other libraries would need to be packaged with CMSB) and PHP 8.1 which everyone isn't on yet, but we're going to start looking into replacement options.  

Dave Edis - Senior Developer

interactivetools.com

By kitsguru - March 3, 2023 - edited: March 3, 2023

I am all for using symphony components. I already use some of them for my websites based on CMSB. 

I use YAML and TWIG components particularly.

Jeff Shields

By zaba - March 9, 2023

Still problems

Deprecated: Callables of the form ["Swift_Message", "Swift_Mime_SimpleMessage::__construct"] are deprecated in /XXXXXX/public_html/cmsb/3rdParty/SwiftMailer5/classes/Swift/Message.php on line 46 Deprecated: Callables of the form ["Swift_SmtpTransport", "Swift_Transport_EsmtpTransport::__construct"] are deprecated in /XXXXXX/public_html/cmsb/3rdParty/SwiftMailer5/classes/Swift/SmtpTransport.php on line 35 Deprecated: strtolower(): Passing null to parameter #1 ($string) of type string is deprecated in /XXXXXX/public_html/cmsb/3rdParty/SwiftMailer5/classes/Swift/Transport/EsmtpTransport.php on line 143 Warning: Cannot modify header information - headers already sent by (output started at /XXXXXX/public_html/cmsb/3rdParty/SwiftMailer5/classes/Swift/Message.php:46) in /XXXXXX/public_html/cmsb/lib/menus/header.php on line 4

By Dave - March 16, 2023 - edited: March 16, 2023

Hi Zaba,

We're just about to release the next version and I'll get these patched for that.  If you get any errors with the new version let me know.

Thank you!

Dave Edis - Senior Developer

interactivetools.com

By zaba - March 17, 2023

That's great Dave, I had to downgrade to PHP 7.4 as the job was about to go live. But I have many sites to upgrade in the coming months so will have the opportunity to test this very soon.

By Dave - March 17, 2023

Hi Zaba, 

Can you try the latest release and let me know if you find any other issues?  Thanks!

https://www.interactivetools.com/forum/forum-posts.php?CMSB-v3.58-Released-Maintenance-Release-82656

Dave Edis - Senior Developer

interactivetools.com

By Dave - March 22, 2023

Hi Zaba, 

Great, thanks for checking and following up!  If you run into any other issues just let us know.

Cheers!

Dave Edis - Senior Developer

interactivetools.com

By Djulia - March 30, 2023 - edited: March 30, 2023

Hi Dave,

I have this alert with PHP 8.2 (v3.58 (Build 2316) :

Callables of the form ["Swift_MailTransport", "Swift_Transport_MailTransport::__construct"] are deprecated
.../3rdParty/SwiftMailer5/classes/Swift/MailTransport.php (line 28)

Thanks,
Djulia