|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2020-06-16 11:57 UTC] cmb@php.net
[2020-06-16 16:08 UTC] atikhonov at plesk dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 14:00:01 2025 UTC |
Description: ------------ In php7.4 the functions "intl_get_error_code", "intl_get_error_message" do not return correct error code/message despite "idn_to_ascii" returns FALSE. The real error code can be retrieved from 'idna_info' array passed to "idn_to_ascii" function. But "intl_get_error_code", "intl_get_error_message" should also work for the backward compatibility. Test script: --------------- // PHP 7.3.x $result=idn_to_ascii('.pm--domain.com', IDNA_DEFAULT, INTL_IDNA_VARIANT_2003); echo intl_get_error_code(); // 66567 echo intl_get_error_message(); // idn_to_ascii: cannot convert to ASCII: U_IDNA_ZERO_LENGTH_LABEL_ERROR // PHP 7.4.x $result=idn_to_ascii('.pm--domain.com.', IDNA_DEFAULT, INTL_IDNA_VARIANT_UTS46, $data); echo intl_get_error_code(); // 0 echo intl_get_error_message(); // U_ZERO_ERROR var_dump($data); /**array(3) { ["result"]=> string(16) ".pm--domain.com." ["isTransitionalDifferent"]=> bool(false) ["errors"]=> int(33) }*/ Expected result: ---------------- echo intl_get_error_code(); // the last error code should be returned echo intl_get_error_message(); // the last error message should be returned