Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal error: idn_to_ascii(): ICU returned an unexpected length. #1

Open
dmitry-kulikov opened this issue Jul 14, 2016 · 0 comments
Open

Comments

@dmitry-kulikov
Copy link
Owner

dmitry-kulikov commented Jul 14, 2016

What steps will reproduce the problem?

Fatal error occurs if used PHP, IDN enabled and domain name length is exactly 255 characters in ASCII representation.

use kdn\yii2\validators\DomainValidator;

$validator = new DomainValidator(['enableIDN' => true]);
// 255 ASCII characters
$validator->validate(str_repeat('a.', 126) . 'aaa', $error);
echo $error;

Other way

use kdn\yii2\validators\DomainValidator;

$validator = new DomainValidator(['enableIDN' => true]);
// "ф" is cyrillic symbol, only 69 characters, but after conversion to ASCII will be 255
$validator->validate(str_repeat('ф.', 31) . 's.s.s.s', $error);
echo $error;

What is the expected result?

the input value is too long.

What do you get instead?

Fatal error: idn_to_ascii(): ICU returned an unexpected length.

Additional info

Q A
Extension version All
Yii version All
PHP version All
HHVM version -
Operating system All

Solution

There was bug in PHP function idn_to_ascii, it was fixed in PHP 5.6 and PHP 7, please upgrade PHP or consider switching to HHVM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant