]> source.dussan.org Git - nextcloud-server.git/commitdiff
use intl's native normalizer_normalize() in case the module is available
authorThomas Müller <thomas.mueller@tmit.eu>
Tue, 9 Sep 2014 12:41:45 +0000 (14:41 +0200)
committerThomas Müller <thomas.mueller@tmit.eu>
Thu, 11 Sep 2014 08:24:31 +0000 (10:24 +0200)
lib/base.php
lib/private/util.php

index 5d52db68cb7730b28395ccee70f34a977d181e4c..e4d4d09f00e99b0def3d91f366e824b036eaffa9 100644 (file)
@@ -495,6 +495,9 @@ class OC {
                        require_once $vendorAutoLoad;
                }
 
+               // initialize intl fallback is necessary
+               \Patchwork\Utf8\Bootup::initIntl();
+
                if (!defined('PHPUNIT_RUN')) {
                        OC\Log\ErrorHandler::setLogger(OC_Log::$object);
                        if (defined('DEBUG') and DEBUG) {
index a130d997ca33373a39c1d9fe94e6c4198d89bf00..79f3eb7b48c50c62f725f48bbe88165e10b3543b 100755 (executable)
@@ -1402,13 +1402,11 @@ class OC_Util {
         * @return bool|string
         */
        public static function normalizeUnicode($value) {
-               if (class_exists('Patchwork\PHP\Shim\Normalizer')) {
-                       $normalizedValue = \Patchwork\PHP\Shim\Normalizer::normalize($value);
-                       if ($normalizedValue === false) {
-                               \OC_Log::write('core', 'normalizing failed for "' . $value . '"', \OC_Log::WARN);
-                       } else {
-                               $value = $normalizedValue;
-                       }
+               $normalizedValue = normalizer_normalize($value);
+               if ($normalizedValue === null || $normalizedValue === false) {
+                       \OC_Log::write('core', 'normalizing failed for "' . $value . '"', \OC_Log::WARN);
+               } else {
+                       $value = $normalizedValue;
                }
 
                return $value;