[TASK] Update mso/idna-convert to 1.1.0 16/48816/2
authorWouter Wolters <typo3@wouterwolters.nl>
Fri, 24 Jun 2016 15:01:37 +0000 (17:01 +0200)
committerMorton Jonuschat <m.jonuschat@mojocode.de>
Thu, 7 Jul 2016 17:38:18 +0000 (19:38 +0200)
Resolves: #76790
Releases: master,7.6
Change-Id: Ib477526a6e5df8275b4fff55a3742811fc20237e
Reviewed-on: https://review.typo3.org/48816
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Morton Jonuschat <m.jonuschat@mojocode.de>
Tested-by: Morton Jonuschat <m.jonuschat@mojocode.de>
composer.json
composer.lock
typo3/sysext/core/Classes/Utility/GeneralUtility.php
typo3/sysext/core/Tests/Unit/Utility/GeneralUtilityTest.php

index 87209f7..ea5ba30 100644 (file)
@@ -44,7 +44,7 @@
                "typo3/cms-composer-installers": "^1.2.8",
                "psr/http-message": "~1.0",
                "cogpowered/finediff": "~0.3.1",
                "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"
        },
        "require-dev": {
                "phpunit/phpunit": "~4.8.0",
        },
        "require-dev": {
                "phpunit/phpunit": "~4.8.0",
index 7b8599a..ae88e6e 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"
     ],
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
         "This file is @generated automatically"
     ],
-    "hash": "572fe1d4e209dcde2d1c829b9ab08939",
-    "content-hash": "e03285824ea6dbc08c9e5a3ab2bfd7e3",
+    "hash": "ac9c4afb53ce61a549fbed3d7c360935",
+    "content-hash": "dfac5b4a3e4d2e1dd13538dd921785c4",
     "packages": [
         {
             "name": "cogpowered/finediff",
     "packages": [
         {
             "name": "cogpowered/finediff",
         },
         {
             "name": "mso/idna-convert",
         },
         {
             "name": "mso/idna-convert",
-            "version": "v0.9.1",
+            "version": "v1.1.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/phlylabs/idna-convert.git",
             "source": {
                 "type": "git",
                 "url": "https://github.com/phlylabs/idna-convert.git",
-                "reference": "0a0a09e460e63739d82c3f0c3f0e5555567a6be3"
+                "reference": "a6dfb6f87611e3a89d2eec4924a0f51db755c573"
             },
             "dist": {
                 "type": "zip",
             },
             "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": "*",
                 "shasum": ""
             },
             "require": {
                 "ext-pcre": "*",
-                "php": ">=5.0.0"
+                "php": ">=5.6.0"
             },
             "type": "library",
             "extra": {
                 "branch-alias": {
             },
             "type": "library",
             "extra": {
                 "branch-alias": {
-                    "dev-master": "0.9.x-dev"
+                    "dev-master": "1.0.x-dev"
                 }
             },
             "autoload": {
                 }
             },
             "autoload": {
-                "classmap": [
-                    "idna_convert.class.php",
-                    "uctc.php"
-                ]
+                "psr-4": {
+                    "Mso\\IdnaConvert\\": "src"
+                }
             },
             "notification-url": "https://packagist.org/downloads/",
             "license": [
             },
             "notification-url": "https://packagist.org/downloads/",
             "license": [
                 "idna",
                 "php"
             ],
                 "idna",
                 "php"
             ],
-            "time": "2016-01-06 21:05:46"
+            "time": "2016-06-19 18:08:43"
         },
         {
             "name": "pear/http_request2",
         },
         {
             "name": "pear/http_request2",
index b924daf..24c75a5 100755 (executable)
@@ -92,7 +92,7 @@ class GeneralUtility
     /**
      * IDNA converter
      *
     /**
      * IDNA converter
      *
-     * @var \idna_convert
+     * @var \Mso\IdnaConvert\IdnaConvert
      */
     protected static $idnaConverter = null;
 
      */
     protected static $idnaConverter = null;
 
@@ -1311,7 +1311,7 @@ class GeneralUtility
             return self::$idnaStringCache[$value];
         } else {
             if (!self::$idnaConverter) {
             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];
             }
             self::$idnaStringCache[$value] = self::$idnaConverter->encode($value);
             return self::$idnaStringCache[$value];
index 9c343a5..f1952dd 100644 (file)
@@ -4740,4 +4740,64 @@ text with a ' . $urlMatch . '$|s'),
        <el type="array"></el>
 </phparray>', $output);
     }
        <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'
+            ]
+        ];
+    }
 }
 }