Overview
Comment:Fix case fold when null
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | stable
Files: files | file ages | folders
SHA3-256: dcde3b82ea3d8df03c26e5582f964c0db20ac93071b96b7b7230557820c4b48c
User & Date: bohwaz on 2021-05-22 14:07:27
Other Links: manifest | tags
Context
2021-05-25
21:53
Fix extension check check-in: 39b4a4b025 user: bohwaz tags: trunk, stable
2021-05-22
14:07
Fix case fold when null check-in: dcde3b82ea user: bohwaz tags: trunk, stable
12:19
Fix: export user dates as french format check-in: 67a32db6a4 user: bohwaz tags: trunk, stable
Changes

Modified src/include/lib/Garradin/Utils.php from [616957930e] to [3c532cfff6].

919
920
921
922
923
924
925
926
927




928
929
930
931
932
933
934
    }

    /**
     * Transforms a unicode string to lowercase AND removes all diacritics
     *
     * @see https://www.matthecat.com/supprimer-les-accents-d-une-chaine-avec-php.html
     */
    static public function unicodeCaseFold(string $str): string
    {




        if (!isset(self::$transliterator) && function_exists('transliterator_create')) {
            self::$transliterator = \Transliterator::create('Any-Latin; NFD; [:Nonspacing Mark:] Remove; NFC; [:Punctuation:] Remove; Lower();');
        }

        if (isset(self::$transliterator)) {
            return self::$transliterator->transliterate($str);
        }







|

>
>
>
>







919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
    }

    /**
     * Transforms a unicode string to lowercase AND removes all diacritics
     *
     * @see https://www.matthecat.com/supprimer-les-accents-d-une-chaine-avec-php.html
     */
    static public function unicodeCaseFold(?string $str): string
    {
        if (null === $str || trim($str) === '') {
            return '';
        }

        if (!isset(self::$transliterator) && function_exists('transliterator_create')) {
            self::$transliterator = \Transliterator::create('Any-Latin; NFD; [:Nonspacing Mark:] Remove; NFC; [:Punctuation:] Remove; Lower();');
        }

        if (isset(self::$transliterator)) {
            return self::$transliterator->transliterate($str);
        }