backdrop-contrib / smtp

Backdrop CMS port of the SMTP module for Drupal 7
GNU General Public License v2.0
4 stars 5 forks source link

Error: Call to undefined function get_magic_quotes_runtime() #27

Open bugfolder opened 10 months ago

bugfolder commented 10 months ago

This error started appearing my dblog:

Error: Call to undefined function get_magic_quotes_runtime() in PHPMailer->EncodeFile() (line 1445 of /mysite/modules/contrib/smtp/includes/smtp.phpmailer.inc).

That's a PHP function, but PHP says it's now removed in PHP 8.0+ (and I just upgraded the site from PHP 7.4 to 8.1).

Can we update this module for PHP 8.1 compatibility?

indigoxela commented 7 months ago

Here's a PR to fix that.

herbdool commented 7 months ago

Since backdrop supports from PHP 5.6 I think we might want to leave it in and add a check for less than 8.0 instead.

indigoxela commented 7 months ago

Since backdrop supports from PHP 5.6 I think we might want to leave it in...

Not necessarily. It's not only about get_magic_quotes_runtime(), which was deprecated in 7.4.0, and removed as of PHP 8.0. It's also about set_magic_quotes_runtime(), which was deprecated 5.3.0, and removed as of PHP 7.0.0.

And in general it's discouraged to rely on magic quotes.

In D7 this has been removed as well.

Seems like the ini directives for magic_quotes have been removed in PHP 5.4 or so, but I can't find an official document for that, as this is "dead" for so long now. :wink: This ini setting doesn't have any effect for a while.