xref: /PHP-7.2/ext/intl/tests/bug72506.phpt (revision 76e249d3)
1--TEST--
2Bug #72506 (idn_to_ascii with INTL_IDNA_VARIANT_UTS46 fatals for long domain names)
3--DESCRIPTION--
4Actually, the $info array should be populated for these cases, but at least it's
5not clear yet with which values exactly.
6--SKIPIF--
7<?php
8if (!extension_loaded('intl')) die('skip this test requires ext/intl');
9if (!defined('INTL_IDNA_VARIANT_UTS46')) die('skip no UTS #46 API');
10?>
11--FILE--
12<?php
13// ASCII domain name with 255 characters
14$domain = str_repeat('a.', 126) . 'aaa';
15$result = idn_to_ascii($domain, 0, INTL_IDNA_VARIANT_UTS46, $info);
16var_dump($result, $info);
17
18// ASCII domain name with 256 characters – one character added
19$domain .= 'a';
20$result = idn_to_ascii($domain, 0, INTL_IDNA_VARIANT_UTS46, $info);
21var_dump($result, $info);
22
23// International domain name with cyrillic "ф" characters
24$domain = str_repeat('ф.', 32) . 'a';
25$result = idn_to_ascii($domain, 0, INTL_IDNA_VARIANT_UTS46, $info);
26var_dump($result, $info);
27?>
28--EXPECT--
29bool(false)
30array(0) {
31}
32bool(false)
33array(0) {
34}
35bool(false)
36array(0) {
37}
38