From 1d34ce60a6cc6f021f0e9254921e6f33b8bc3cd2 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Fri, 26 Mar 2021 10:44:55 +0100 Subject: remove __autoload usage from autoloader for PHP 8 --- PHPMailer-path.patch | 33 +++++++++++++++++++++++++++++---- php-PHPMailer.spec | 14 +++++++++++++- 2 files changed, 42 insertions(+), 5 deletions(-) diff --git a/PHPMailer-path.patch b/PHPMailer-path.patch index 59a0ca5..3b7b330 100644 --- a/PHPMailer-path.patch +++ b/PHPMailer-path.patch @@ -1,7 +1,7 @@ diff -up ./class.phpmailer.php.rpm ./class.phpmailer.php ---- ./class.phpmailer.php.rpm 2016-12-09 11:03:48.000000000 +0100 -+++ ./class.phpmailer.php 2016-12-09 15:03:58.489947280 +0100 -@@ -1475,6 +1475,7 @@ class PHPMailer +--- ./class.phpmailer.php.rpm 2020-03-19 15:29:37.000000000 +0100 ++++ ./class.phpmailer.php 2021-03-26 10:33:39.989407757 +0100 +@@ -1534,6 +1534,7 @@ class PHPMailer public function getSMTPInstance() { if (!is_object($this->smtp)) { @@ -9,7 +9,7 @@ diff -up ./class.phpmailer.php.rpm ./class.phpmailer.php $this->smtp = new SMTP; } return $this->smtp; -@@ -1730,7 +1731,7 @@ class PHPMailer +@@ -1795,7 +1796,7 @@ class PHPMailer ); if (empty($lang_path)) { // Calculate an absolute path so it can work if CWD is not here @@ -18,3 +18,28 @@ diff -up ./class.phpmailer.php.rpm ./class.phpmailer.php } //Validate $langcode if (!preg_match('/^[a-z]{2}(?:_[a-zA-Z]{2})?$/', $langcode)) { +diff -up ./PHPMailerAutoload.php.rpm ./PHPMailerAutoload.php +--- ./PHPMailerAutoload.php.rpm 2021-03-26 10:34:09.218276732 +0100 ++++ ./PHPMailerAutoload.php 2021-03-26 10:34:35.311159763 +0100 +@@ -30,20 +30,4 @@ function PHPMailerAutoload($classname) + } + } + +-if (version_compare(PHP_VERSION, '5.1.2', '>=')) { +- //SPL autoloading was introduced in PHP 5.1.2 +- if (version_compare(PHP_VERSION, '5.3.0', '>=')) { +- spl_autoload_register('PHPMailerAutoload', true, true); +- } else { +- spl_autoload_register('PHPMailerAutoload'); +- } +-} else { +- /** +- * Fall back to traditional autoload for old PHP versions +- * @param string $classname The name of the class to load +- */ +- function __autoload($classname) +- { +- PHPMailerAutoload($classname); +- } +-} ++spl_autoload_register('PHPMailerAutoload', true, true); diff --git a/php-PHPMailer.spec b/php-PHPMailer.spec index 6166a86..a7b1b59 100644 --- a/php-PHPMailer.spec +++ b/php-PHPMailer.spec @@ -17,7 +17,7 @@ Name: php-PHPMailer Summary: PHP email transport class with a lot of features Version: 5.2.28 -Release: 2%{?dist} +Release: 6%{?dist} License: LGPLv2+ URL: https://github.com/%{github_user}/%{github_app} @@ -25,6 +25,7 @@ Source0: https://github.com/%{github_user}/%{github_app}/archive/%{github_tag}/% # Fix language default path # Don't rely on autoloader (for app which overides __construct) +# Cleanup autoloader Patch0: %{github_app}-path.patch Patch1: %{github_app}-5.2.28-cve2020-13625.patch @@ -37,7 +38,11 @@ BuildRequires: php-cli Requires: php-date Requires: php-filter Requires: php-hash +%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8 +Recommends: php-imap +%else Requires: php-imap +%endif Requires: php-intl Requires: php-mbstring Requires: php-openssl @@ -141,6 +146,13 @@ version_compare($mailer->Version, "%{version}", "=") or exit(1); %changelog +* Fri Mar 26 2021 Remi Collet - 5.2.28-6 +- remove __autoload usage from autoloader for PHP 8 + +* Thu Feb 25 2021 Patrick Monnerat 5.2.28-5 +- php-imap is optional. + https://bugzilla.redhat.com/show_bug.cgi?id=1933024 + * Sun Jun 21 2020 Patrick Monnerat 5.2.28-2 - Patch "cve2020-13625" fixes CVE-2020-13625 vulnerability. This is a backport of https://github.com/PHPMailer/PHPMailer/commit/c2796cb. -- cgit