Skip to content

Commit

Permalink
Revert "Move to non deprecated API on suitable ICU versions"
Browse files Browse the repository at this point in the history
This reverts commit 13a2f2d.

The APIs used by this commit aren't entirely equivalent to the original ones.
  • Loading branch information
sgolemon committed Aug 16, 2019
1 parent 4966647 commit 9b9814f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 19 deletions.
4 changes: 4 additions & 0 deletions NEWS
Expand Up @@ -2,6 +2,10 @@ PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? ????, PHP 7.3.10

- Intl:
. Ensure IDNA2003 rules are used with idn_to_ascii() and idn_to_utf8()
when requested. (Sara)

29 Aug 2019, PHP 7.3.9

- Core:
Expand Down
20 changes: 1 addition & 19 deletions ext/intl/idn/idn.c
Expand Up @@ -224,34 +224,16 @@ static void php_intl_idn_to(INTERNAL_FUNCTION_PARAMETERS,
}
RETURN_FALSE;
} else {
UParseError parse_error;
UChar converted[MAXPATHLEN];
int32_t converted_ret_len;

status = U_ZERO_ERROR;

#if U_ICU_VERSION_MAJOR_NUM >= 55
UIDNAInfo info = UIDNA_INFO_INITIALIZER;
UIDNA *idna = uidna_openUTS46((int32_t)option, &status);

if (U_FAILURE(status)) {
intl_error_set( NULL, status, "idn_to_ascii: failed to create an UIDNA instance", 0 );
RETURN_FALSE;
}

if (mode == INTL_IDN_TO_ASCII) {
converted_ret_len = uidna_nameToASCII(idna, ustring, ustring_len, converted, MAXPATHLEN, &info, &status);
} else {
converted_ret_len = uidna_nameToUnicode(idna, ustring, ustring_len, converted, MAXPATHLEN, &info, &status);
}
uidna_close(idna);
#else
UParseError parse_error;
if (mode == INTL_IDN_TO_ASCII) {
converted_ret_len = uidna_IDNToASCII(ustring, ustring_len, converted, MAXPATHLEN, (int32_t)option, &parse_error, &status);
} else {
converted_ret_len = uidna_IDNToUnicode(ustring, ustring_len, converted, MAXPATHLEN, (int32_t)option, &parse_error, &status);
}
#endif
efree(ustring);

if (U_FAILURE(status)) {
Expand Down

1 comment on commit 9b9814f

@nikic
Copy link
Member

@nikic nikic commented on 9b9814f Aug 20, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you provide more context for this revert? The original change has been in place since PHP 7.3.0. Especially if there is a behavioral difference, having it introduced in 7.3.0 is ideal, rather than going back and forth with it in patch releases.

Please sign in to comment.