url icon indicating copy to clipboard operation
url copied to clipboard

A domain with invalid length isn't accepted / 長さが不正なドメインが受け入れられない

Open esperecyan opened this issue 9 years ago • 0 comments

  • PHP 5.6.10
  • Intl 1.1.0
  • ICU 50.1.2
  • esperecyan/url 1.0.2

If lib\HostProcessing::domainToASCII() or lib\HostProcessing::domainToUnicode() is passed a domain exceeding 253 characters or containing a label exceeding 63 characters, the methods may return false. For this reason, the tests, lib\HostProcessingTest::testDomainToASCII with data set #15,16,18 and lib\HostProcessingTest::testDomainToUnicode with data set #15,16, fail, and structural elements depending the methods influence. This cause is the methods use idn_to_ascii() and idn_to_utf8(), and the functions don't completely correspond with ToASCII and ToUnicode.

A possible solution would be to use a library implementing ToASCII and ToUnicode according to the specification, instead of the functions.


253文字を超えるドメイン、63文字を超えるラベルを含むドメインを渡すと、lib\HostProcessing::domainToASCII()、およびlib\HostProcessing::domainToUnicode()が偽を返す場合があります。このため、lib\HostProcessingTest::testDomainToASCII with data set #15,16,18lib\HostProcessingTest::testDomainToUnicode with data set #15,16のテストが失敗し、これらのメソッドに依存している構造要素も影響を受けます。これらのメソッドは内部でidn_to_ascii()idn_to_utf8()を利用していますが、その関数がToASCIIToUnicodeと完全な対応関係にないことが原因です。

ToASCII、およびToUnicodeを仕様通りに実装したライブラリを、これらの関数の代わりに利用することが解決方法として考えられます。

The influenced structural elements / 影響を受ける構造要素

esperecyan avatar Jun 25 '15 10:06 esperecyan