xref: /PHP-8.3/ext/intl/tests/bug72506.phpt (revision 74859783)
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--EXTENSIONS--
7intl
8--SKIPIF--
9<?php
10if (!defined('INTL_IDNA_VARIANT_UTS46')) die('skip no UTS #46 API');
11?>
12--FILE--
13<?php
14// ASCII domain name with 255 characters
15$domain = str_repeat('a.', 126) . 'aaa';
16$result = idn_to_ascii($domain, 0, INTL_IDNA_VARIANT_UTS46, $info);
17var_dump($result, $info);
18
19// ASCII domain name with 256 characters – one character added
20$domain .= 'a';
21$result = idn_to_ascii($domain, 0, INTL_IDNA_VARIANT_UTS46, $info);
22var_dump($result, $info);
23
24// International domain name with cyrillic "ф" characters
25$domain = str_repeat('ф.', 32) . 'a';
26$result = idn_to_ascii($domain, 0, INTL_IDNA_VARIANT_UTS46, $info);
27var_dump($result, $info);
28?>
29--EXPECT--
30bool(false)
31array(0) {
32}
33bool(false)
34array(0) {
35}
36bool(false)
37array(0) {
38}
39