From: Michael M Slusarz Date: Fri, 5 Mar 2010 17:18:14 +0000 (-0700) Subject: utf8_[en|de]code() requires xml extension X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=f4755dbb59d9af7d03ede5db67b7250858cbef32;p=horde.git utf8_[en|de]code() requires xml extension --- diff --git a/framework/Util/lib/Horde/String.php b/framework/Util/lib/Horde/String.php index db02febf2..a98813525 100644 --- a/framework/Util/lib/Horde/String.php +++ b/framework/Util/lib/Horde/String.php @@ -135,8 +135,10 @@ class Horde_String /* Use utf8_[en|de]code() if possible and if the string isn't too * large (less than 16 MB = 16 * 1024 * 1024 = 16777216 bytes) - these * functions use more memory. */ - if ((strlen($input) < 16777216) || - !(Horde_Util::extensionExists('iconv') || Horde_Util::extensionExists('mbstring'))) { + if (Horde_Util::extensionExists('xml') && + ((strlen($input) < 16777216) || + !Horde_Util::extensionExists('iconv') || + !Horde_Util::extensionExists('mbstring'))) { if (($to == 'utf-8') && in_array($from, array('iso-8859-1', 'us-ascii'))) { return utf8_encode($input); diff --git a/framework/Util/lib/Horde/Util.php b/framework/Util/lib/Horde/Util.php index a36ae1176..88a83e855 100644 --- a/framework/Util/lib/Horde/Util.php +++ b/framework/Util/lib/Horde/Util.php @@ -787,7 +787,9 @@ class Horde_Util static public function convertToUtf8($in) { if (is_string($in)) { - $in = utf8_encode($in); + if (self::extensionExists('xml')) { + $in = utf8_encode($in); + } } elseif (is_array($in)) { reset($in); while (list($key, $val) = each($in)) { diff --git a/framework/Util/package.xml b/framework/Util/package.xml index 843ec8ee5..f5d37e3f4 100644 --- a/framework/Util/package.xml +++ b/framework/Util/package.xml @@ -89,6 +89,9 @@ http://pear.php.net/dtd/package-2.0.xsd"> mbstring + + xml +