Bug #79705 [NEW]: Functions "intl_get_error_code", "intl_get_error_message" work incorrectly
| From: | alex dot vl dot tihon at gmail dot com | Date: | Tue, 16 Jun 2020 09:49:24 +0000 |
| Subject: | Bug #79705 [NEW]: Functions "intl_get_error_code", "intl_get_error_message" work incorrectly | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-227503@lists.php.net to get a copy of this message | ||
From: alex dot vl dot tihon at gmail dot com
Operating system: Ubuntu 20.04 LTS
PHP version: 7.4.7
Package: Unknown/Other Function
Bug Type: Bug
Bug description:Functions "intl_get_error_code", "intl_get_error_message" work
incorrectly
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
--
Edit bug report at https://bugs.php.net/bug.php?id=79705&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=79705&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=79705&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=79705&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=79705&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=79705&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=79705&r=support
Expected behavior: https://bugs.php.net/fix.php?id=79705&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=79705&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=79705&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=79705&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=79705&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=79705&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=79705&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=79705&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=79705&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=79705&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=79705&r=mysqlcfg