Skip to content

Commit

Permalink
Use older PCRE pattern if using a troublesome lib version, fixes PHPM…
Browse files Browse the repository at this point in the history
  • Loading branch information
Synchro committed Aug 5, 2014
1 parent 022382c commit 125e9a0
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions class.phpmailer.php
Expand Up @@ -856,12 +856,18 @@ public function getLastMessageID()
public static function validateAddress($address, $patternselect = 'auto')
{
if (!$patternselect or $patternselect == 'auto') {
if (defined('PCRE_VERSION')) { //Check this constant so it works when extension_loaded() is disabled
if (version_compare(PCRE_VERSION, '8.0') >= 0) {
//Check this constant first so it works when extension_loaded() is disabled by safe mode
//Constant was added in PHP 5.2.4
if (defined('PCRE_VERSION')) {
//This pattern can get stuck in a recursive loop in PCRE <= 8.0.2
if (version_compare(PCRE_VERSION, '8.0.3') >= 0) {
$patternselect = 'pcre8';
} else {
$patternselect = 'pcre';
}
} elseif (function_exists('extension_loaded') and extension_loaded('pcre')) {
//Fall back to older PCRE
$patternselect = 'pcre';
} else {
//Filter_var appeared in PHP 5.2.0 and does not require the PCRE extension
if (version_compare(PHP_VERSION, '5.2.0') >= 0) {
Expand Down

0 comments on commit 125e9a0

Please sign in to comment.