Remove use of deprecated /e modifier in preg_replace.
[squirrelmail.git] / functions / encode / cp1251.php
index 2afead9c162bb660b102654d43308623df0992db..58a0282b64e24fd151caf04b6b828a56a8fa31b2 100644 (file)
@@ -22,7 +22,7 @@ function charset_encode_cp1251 ($string) {
    // don't run encoding function, if there is no encoded characters
    if (! preg_match("'&#[0-9]+;'",$string) ) return $string;
 
-    $string=preg_replace("/&#([0-9]+);/e","unicodetocp1251('\\1')",$string);
+    $string=preg_replace_callback("/&#([0-9]+);/", 'unicodetocp1251', $string);
 
     return $string;
 }
@@ -35,10 +35,11 @@ function charset_encode_cp1251 ($string) {
  * Don't use it or make sure, that functions/encode/cp1251.php is
  * included.
  *
- * @param int $var decimal unicode value
+ * @param array $matches array with first element a decimal unicode value
  * @return string cp1251 character
  */
-function unicodetocp1251($var) {
+function unicodetocp1251($matches) {
+    $var = $matches[1];
 
     $cp1251chars=array('160' => "\xA0",
                        '164' => "\xA4",