Merge pull request #339 from cytopia/php-72-depreceated

Fix PHP 7.2 deprecated function: create_function()
This commit is contained in:
cytopia 2018-08-05 17:00:49 +02:00 committed by GitHub
commit fad7571875
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -832,10 +832,16 @@ class Mail_mimeDecode extends PEAR
// Remove soft line breaks
$input = preg_replace("/=\r?\n/", '', $input);
// Replace encoded characters
$cb = create_function('$matches', ' return chr(hexdec($matches[0]));');
// cytopia edit
if (version_compare(PHP_VERSION, '7.2.0', '>=')) {
$cb = function($matches) {
return chr(hexdec($matches[0]));
};
} else {
// Replace encoded characters
$cb = create_function('$matches', ' return chr(hexdec($matches[0]));');
}
$input = preg_replace_callback( '/=([a-f0-9]{2})/i', $cb, $input);
return $input;