[TASK] Update mso/idna-convert to 1.1.0 74/48674/6
authorWouter Wolters <typo3@wouterwolters.nl>
Fri, 24 Jun 2016 15:01:37 +0000 (17:01 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Wed, 6 Jul 2016 08:18:58 +0000 (10:18 +0200)
Resolves: #76790
Releases: master,7.6
Change-Id: Ib477526a6e5df8275b4fff55a3742811fc20237e
Reviewed-on: https://review.typo3.org/48674
Tested-by: Bamboo TYPO3com <info@typo3.com>
Reviewed-by: Susanne Moog <typo3@susannemoog.de>
Tested-by: Susanne Moog <typo3@susannemoog.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
composer.json
composer.lock
typo3/sysext/core/Classes/Utility/GeneralUtility.php
typo3/sysext/core/Tests/Unit/Utility/GeneralUtilityTest.php

index 592e877..fc73e17 100644 (file)
@@ -46,7 +46,7 @@
                "typo3/cms-composer-installers": "^1.2.8",
                "psr/http-message": "~1.0",
                "cogpowered/finediff": "~0.3.1",
-               "mso/idna-convert": "^0.9.1",
+               "mso/idna-convert": "^1.1.0",
                "typo3fluid/fluid": "^1.0.7",
                "guzzlehttp/guzzle": "^6.2.0",
                "doctrine/dbal": "~2.5.4"
index 65a3f28..91fbc9f 100644 (file)
@@ -4,8 +4,8 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
         "This file is @generated automatically"
     ],
-    "hash": "c82a4925198d3546222cd144c629028d",
-    "content-hash": "726cef58a682d58158b9789f2fcd2735",
+    "hash": "11553ed8cb705ff185a69b5af57cb0ce",
+    "content-hash": "4fecfd304523851856ead48e9cf353c2",
     "packages": [
         {
             "name": "cogpowered/finediff",
         },
         {
             "name": "mso/idna-convert",
-            "version": "v0.9.1",
+            "version": "v1.1.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/phlylabs/idna-convert.git",
-                "reference": "0a0a09e460e63739d82c3f0c3f0e5555567a6be3"
+                "reference": "a6dfb6f87611e3a89d2eec4924a0f51db755c573"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/phlylabs/idna-convert/zipball/0a0a09e460e63739d82c3f0c3f0e5555567a6be3",
-                "reference": "0a0a09e460e63739d82c3f0c3f0e5555567a6be3",
+                "url": "https://api.github.com/repos/phlylabs/idna-convert/zipball/a6dfb6f87611e3a89d2eec4924a0f51db755c573",
+                "reference": "a6dfb6f87611e3a89d2eec4924a0f51db755c573",
                 "shasum": ""
             },
             "require": {
                 "ext-pcre": "*",
-                "php": ">=5.0.0"
+                "php": ">=5.6.0"
             },
             "type": "library",
             "extra": {
                 "branch-alias": {
-                    "dev-master": "0.9.x-dev"
+                    "dev-master": "1.0.x-dev"
                 }
             },
             "autoload": {
-                "classmap": [
-                    "idna_convert.class.php",
-                    "uctc.php"
-                ]
+                "psr-4": {
+                    "Mso\\IdnaConvert\\": "src"
+                }
             },
             "notification-url": "https://packagist.org/downloads/",
             "license": [
                 "idna",
                 "php"
             ],
-            "time": "2016-01-06 21:05:46"
+            "time": "2016-06-19 18:08:43"
         },
         {
             "name": "psr/http-message",
index 8ea1697..caf8b7a 100755 (executable)
@@ -94,7 +94,7 @@ class GeneralUtility
     /**
      * IDNA converter
      *
-     * @var \idna_convert
+     * @var \Mso\IdnaConvert\IdnaConvert
      */
     protected static $idnaConverter = null;
 
@@ -1078,7 +1078,7 @@ class GeneralUtility
             return self::$idnaStringCache[$value];
         } else {
             if (!self::$idnaConverter) {
-                self::$idnaConverter = new \idna_convert(array('idn_version' => 2008));
+                self::$idnaConverter = new \Mso\IdnaConvert\IdnaConvert(array('idn_version' => 2008));
             }
             self::$idnaStringCache[$value] = self::$idnaConverter->encode($value);
             return self::$idnaStringCache[$value];
index 190224d..d2d5f01 100644 (file)
@@ -4618,4 +4618,64 @@ class GeneralUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
        <el type="array"></el>
 </phparray>', $output);
     }
+
+    /**
+     * @test
+     * @dataProvider idnaEncodeDataProvider
+     * @param $actual
+     * @param $expected
+     */
+    public function idnaEncodeConvertsUnicodeCharsToASCIIString($actual, $expected)
+    {
+        $result = GeneralUtility::idnaEncode($actual);
+        $this->assertSame($expected, $result);
+    }
+
+    /**
+     * Data provider for method idnaEncode in GeneralUtility class.
+     * IDNA converter has to convert special chars (UTF-8) to ASCII compatible chars.
+     *
+     * @returns array
+     */
+    public function idnaEncodeDataProvider()
+    {
+        return [
+            'empty string' => [
+                '',
+                ''
+            ],
+            'null value' => [
+                null,
+                ''
+            ],
+            'string with ascii chars' => [
+                'example',
+                'example'
+            ],
+            'domain (1) with utf8 chars' => [
+                'dömäin.example',
+                'xn--dmin-moa0i.example'
+            ],
+            'domain (2) with utf8 chars' => [
+                'äaaa.example',
+                'xn--aaa-pla.example'
+            ],
+            'domain (3) with utf8 chars' => [
+                'déjà.vu.example',
+                'xn--dj-kia8a.vu.example'
+            ],
+            'domain (4) with utf8 chars' => [
+                'foo.âbcdéf.example',
+                'foo.xn--bcdf-9na9b.example'
+            ],
+            'domain with utf8 char (german umlaut)' => [
+                'exömple.com',
+                'xn--exmple-xxa.com'
+            ],
+            'email with utf8 char (german umlaut)' => [
+                'joe.doe@dömäin.de',
+                'joe.doe@xn--dmin-moa0i.de'
+            ]
+        ];
+    }
 }