Migrate away from using create_function as long as PHP 5.3+ is available
[squirrelmail.git] / functions / mime.php
index 3102fc3c17ff9d1ac67fe4dfe0cbf5bb326b4d70..ae6b735a55611b59728f7570a9dc8f5b2622d298 100644 (file)
@@ -903,8 +903,11 @@ function decodeHeader ($string, $utfencode=true,$htmlsafe=true,$decide=false) {
                 case 'Q':
                     $replace = str_replace('_', ' ', $res[4]);
                     $replace = preg_replace_callback('/=([0-9a-f]{2})/i',
-                            create_function ('$matches', 'return chr(hexdec($matches[1]));'),
-                            $replace);
+                                             (check_php_version(5, 3, 0)
+                                              ? function($matches) { return chr(hexdec($matches[1])); }
+                                              : create_function ('$matches', 'return chr(hexdec($matches[1]));')
+                                             ),
+                                             $replace);
                     if ($utfencode) {
                         if ($can_be_encoded) {
                             /* convert string to different charset,