From 6ddb16d181e285d4f0ef0ef55bdd0ba787f1b583 Mon Sep 17 00:00:00 2001
From: Thomas Bruederli <thomas@roundcube.net>
Date: Sat, 17 Nov 2012 10:24:09 -0500
Subject: [PATCH] Merge branch 'master' of github.com:roundcube/roundcubemail

---
 program/include/rcube_utils.php |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/program/include/rcube_utils.php b/program/include/rcube_utils.php
index 23bf556..dfaa9b9 100644
--- a/program/include/rcube_utils.php
+++ b/program/include/rcube_utils.php
@@ -24,7 +24,8 @@
 /**
  * Utility class providing common functions
  *
- * @package Core
+ * @package    Framework
+ * @subpackage Utils
  */
 class rcube_utils
 {
@@ -221,6 +222,10 @@
         static $js_rep_table = false;
         static $xml_rep_table = false;
 
+        if (!is_string($str)) {
+            $str = strval($str);
+        }
+
         // encode for HTML output
         if ($enctype == 'html') {
             if (!$html_encode_arr) {
@@ -245,9 +250,6 @@
             }
 
             $out = strtr($str, $encode_arr);
-
-            // avoid douple quotation of &
-            $out = preg_replace('/&amp;([A-Za-z]{2,6}|#[0-9]{2,4});/', '&\\1;', $out);
 
             return $newlines ? nl2br($out) : $out;
         }
@@ -678,7 +680,7 @@
         // %s - domain name after the '@' from e-mail address provided at login screen. Returns FALSE if an invalid email is provided
         if (strpos($name, '%s') !== false) {
             $user_email = self::get_input_value('_user', self::INPUT_POST);
-            $user_email = rcube_utils::idn_convert($user_email, true);
+            $user_email = self::idn_convert($user_email, true);
             $matches    = preg_match('/(.*)@([a-z0-9\.\-\[\]\:]+)/i', $user_email, $s);
             if ($matches < 1 || filter_var($s[1]."@".$s[2], FILTER_VALIDATE_EMAIL) === false) {
                 return false;
@@ -760,7 +762,7 @@
             }
         }
 
-        $result[] = substr($string, $p);
+        $result[] = (string) substr($string, $p);
 
         return $result;
     }

--
Gitblit v1.9.1