Skip to content

Undefined index/Uninitialized string offset running polyfill-intl-idn against Unicode test suite #265

Closed
@TRowbotham

Description

@TRowbotham

As promised in #159 (comment), here is the stack trace when running symfony/polyfill-intl-idn against the Unicode test suite. I haven't actually looked at the code to see what may be happening.

STR:

  1. Make sure you disable ext-intl or use the Symfony\Polyfill\Intl\Idn\Idn class directly.
  2. Use idn_to_utf8();
  3. Set the $domain parameter to the first string in the test data set.
  4. Set the $options parameter to 0. (doesn't matter what the value is)
  5. Set the $variant parameter to INTL_IDNA_VARIANT_UTS46 (doesn't matter; same problem using INTL_IDNA_VARIANT_2003)

Minimal example test case:

$source = 'Ü.xn--Tda';
idn_to_utf8($source, 0, INTL_IDNA_VARIANT_UTS46, $info);

There were 7 errors:

  1. Rowbot\Idna\Test\SymfonyPolyfill::testToUtf8 with data set Add support of JSON_THROW_ON_ERROR global constant #168 ('Ü.xn--Tda', 'ü.ü', '', 'xn--tda.xn--tda', '', '', '')
    Undefined index: T

/home/trevor/GitHub/IDNA/vendor/symfony/polyfill-intl-idn/Idn.php:266
/home/trevor/GitHub/IDNA/vendor/symfony/polyfill-intl-idn/Idn.php:114
/home/trevor/GitHub/IDNA/tests/SymfonyPolyfill.php:63

  1. Rowbot\Idna\Test\SymfonyPolyfill::testToUtf8 with data set Add Normalizer::getRawDecomposition() and normalizer_get_raw_decomposition() #169 ('Ü.xn--Tda', 'ü.ü', '', 'xn--tda.xn--tda', '', '', '')
    Undefined index: T

/home/trevor/GitHub/IDNA/vendor/symfony/polyfill-intl-idn/Idn.php:266
/home/trevor/GitHub/IDNA/vendor/symfony/polyfill-intl-idn/Idn.php:114
/home/trevor/GitHub/IDNA/tests/SymfonyPolyfill.php:63

  1. Rowbot\Idna\Test\SymfonyPolyfill::testToUtf8 with data set [Mbstring] weird behaviour with mb_substr on PHP5 versions #184 ('xn--0.pt', '', '[P4]', '', '', '', '')
    Uninitialized string offset: 1

/home/trevor/GitHub/IDNA/vendor/symfony/polyfill-intl-idn/Idn.php:266
/home/trevor/GitHub/IDNA/vendor/symfony/polyfill-intl-idn/Idn.php:114
/home/trevor/GitHub/IDNA/tests/SymfonyPolyfill.php:63

  1. Rowbot\Idna\Test\SymfonyPolyfill::testToUtf8 with data set Incorrect implementation of hrtime #186 ('xn--a-Ä.pt', 'xn--a-ä.pt', '[P4]', 'xn--xn--a--gua.pt', '', '', '')
    Undefined index: �

/home/trevor/GitHub/IDNA/vendor/symfony/polyfill-intl-idn/Idn.php:266
/home/trevor/GitHub/IDNA/vendor/symfony/polyfill-intl-idn/Idn.php:114
/home/trevor/GitHub/IDNA/tests/SymfonyPolyfill.php:63

  1. Rowbot\Idna\Test\SymfonyPolyfill::testToUtf8 with data set Ensure hrtime is monotonic #187 ('xn--a-Ä.pt', 'xn--a-ä.pt', '[P4]', 'xn--xn--a--gua.pt', '', '', '')
    Undefined index: A

/home/trevor/GitHub/IDNA/vendor/symfony/polyfill-intl-idn/Idn.php:266
/home/trevor/GitHub/IDNA/vendor/symfony/polyfill-intl-idn/Idn.php:114
/home/trevor/GitHub/IDNA/tests/SymfonyPolyfill.php:63

  1. Rowbot\Idna\Test\SymfonyPolyfill::testToUtf8 with data set [grapheme] fix handling negative offsets #188 ('xn--a-ä.pt', 'xn--a-ä.pt', '[P4]', 'xn--xn--a--gua.pt', '', '', '')
    Undefined index: �

/home/trevor/GitHub/IDNA/vendor/symfony/polyfill-intl-idn/Idn.php:266
/home/trevor/GitHub/IDNA/vendor/symfony/polyfill-intl-idn/Idn.php:114
/home/trevor/GitHub/IDNA/tests/SymfonyPolyfill.php:63

  1. Rowbot\Idna\Test\SymfonyPolyfill::testToUtf8 with data set [Mbstring] fix mb_strrpos with negative offset #189 ('xn--a-ä.pt', '', '[P4]', 'xn--xn--a--gua.pt', '', '', '')
    Undefined index: �

/home/trevor/GitHub/IDNA/vendor/symfony/polyfill-intl-idn/Idn.php:266
/home/trevor/GitHub/IDNA/vendor/symfony/polyfill-intl-idn/Idn.php:114
/home/trevor/GitHub/IDNA/tests/SymfonyPolyfill.php:63

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions