Browse Source

Some more replacments in Subs-Post.

Signed-off-by: Jeremy D <[email protected]>
Jeremy D 11 years ago
parent
commit
0589d27383
1 changed files with 4 additions and 3 deletions
  1. 4 3
      Sources/Subs-Post.php

+ 4 - 3
Sources/Subs-Post.php

@@ -1221,7 +1221,7 @@ function mimespecialchars($string, $with_charset = true, $hotmail_fix = false, $
 		unset($matches);
 
 		if ($simple)
-			$string = preg_replace('~&#(\d{3,8});~e', 'chr(\'$1\')', $string);
+			$string = preg_replace_callback('~&#(\d{3,8});~', create_function('$m', ' return chr("$m[1]");'), $string);
 		else
 		{
 			// Try to convert the string to UTF-8.
@@ -1249,7 +1249,8 @@ function mimespecialchars($string, $with_charset = true, $hotmail_fix = false, $
 				$string = $newstring;
 		}
 
-		$entityConvert = create_function('$c', '
+		$entityConvert = create_function('$m', '
+			$c = $m[1];
 			if (strlen($c) === 1 && ord($c[0]) <= 0x7F)
 				return $c;
 			elseif (strlen($c) === 2 && ord($c[0]) >= 0xC0 && ord($c[0]) <= 0xDF)
@@ -1262,7 +1263,7 @@ function mimespecialchars($string, $with_charset = true, $hotmail_fix = false, $
 				return "";');
 
 		// Convert all 'special' characters to HTML entities.
-		return array($charset, preg_replace('~([\x80-\x{10FFFF}])~eu', '$entityConvert(\'\1\')', $string), '7bit');
+		return array($charset, preg_replace_callback('~([\x80-\x{10FFFF}])~u', $entityConvert, $string), '7bit');
 	}
 
 	// We don't need to mess with the subject line if no special characters were in it..