X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=src%2Fphp_http_url.c;h=029e6a8ca37c3cf64a59c06ddb1e280fb7b63239;hp=738cfb06092af11eea1362ce2df3b71bf0a4316a;hb=fdf49093c6ef7cffdd82b44230ac4c75643223a3;hpb=2e92ec70991d53cb3d6d710ae7a6b3a6b31ec978 diff --git a/src/php_http_url.c b/src/php_http_url.c index 738cfb0..029e6a8 100644 --- a/src/php_http_url.c +++ b/src/php_http_url.c @@ -21,13 +21,17 @@ #if PHP_HTTP_HAVE_LIBICU # include #endif +#if PHP_HTTP_HAVE_LIBIDNKIT || PHP_HTTP_HAVE_LIBIDNKIT2 +# include +# include +#endif -#ifdef PHP_HTTP_HAVE_WCHAR +#if PHP_HTTP_HAVE_WCHAR # include # include #endif -#ifdef HAVE_ARPA_INET_H +#if HAVE_ARPA_INET_H # include #endif @@ -37,13 +41,13 @@ static inline char *localhostname(void) { char hostname[1024] = {0}; -#ifdef PHP_WIN32 +#if PHP_WIN32 if (SUCCESS == gethostname(hostname, lenof(hostname))) { return estrdup(hostname); } -#elif defined(HAVE_GETHOSTNAME) +#elif HAVE_GETHOSTNAME if (SUCCESS == gethostname(hostname, lenof(hostname))) { -# if defined(HAVE_GETDOMAINNAME) +# if HAVE_GETDOMAINNAME size_t hlen = strlen(hostname); if (hlen <= lenof(hostname) - lenof("(none)")) { hostname[hlen++] = '.'; @@ -674,17 +678,17 @@ static size_t parse_mb_utf8(unsigned *wc, const char *ptr, const char *end) return consumed; } -#ifdef PHP_HTTP_HAVE_WCHAR +#if PHP_HTTP_HAVE_WCHAR static size_t parse_mb_loc(unsigned *wc, const char *ptr, const char *end) { wchar_t wchar; size_t consumed = 0; -#if defined(HAVE_MBRTOWC) +#if HAVE_MBRTOWC mbstate_t ps; memset(&ps, 0, sizeof(ps)); consumed = mbrtowc(&wchar, ptr, end - ptr, &ps); -#elif defined(HAVE_MBTOWC) +#elif HAVE_MBTOWC consumed = mbtowc(&wchar, ptr, end - ptr); #endif @@ -719,7 +723,7 @@ static const char * const parse_what[] = { static const char parse_xdigits[] = "0123456789ABCDEF"; -static size_t parse_mb(struct parse_state *state, parse_mb_what_t what, const char *ptr, const char *end, const char *begin, zend_bool silent) +static size_t parse_mb(struct parse_state *state, parse_mb_what_t what, const char *ptr, const char *end, const char *begin, zend_bool force_silent) { unsigned wchar; size_t consumed = 0; @@ -727,7 +731,7 @@ static size_t parse_mb(struct parse_state *state, parse_mb_what_t what, const ch if (state->flags & PHP_HTTP_URL_PARSE_MBUTF8) { consumed = parse_mb_utf8(&wchar, ptr, end); } -#ifdef PHP_HTTP_HAVE_WCHAR +#if PHP_HTTP_HAVE_WCHAR else if (state->flags & PHP_HTTP_URL_PARSE_MBLOC) { consumed = parse_mb_loc(&wchar, ptr, end); } @@ -741,7 +745,7 @@ static size_t parse_mb(struct parse_state *state, parse_mb_what_t what, const ch if (!isualnum(wchar)) { break; } -#ifdef PHP_HTTP_HAVE_WCHAR +#if PHP_HTTP_HAVE_WCHAR } else if (state->flags & PHP_HTTP_URL_PARSE_MBLOC) { if (!iswalnum(wchar)) { break; @@ -763,7 +767,7 @@ static size_t parse_mb(struct parse_state *state, parse_mb_what_t what, const ch return consumed; } - if (!silent) { + if (!force_silent && !(state->flags & PHP_HTTP_URL_SILENT_ERRORS)) { if (consumed) { php_error_docref(NULL, E_WARNING, "Failed to parse %s; unexpected multibyte sequence 0x%x at pos %u in '%s'", @@ -775,6 +779,11 @@ static size_t parse_mb(struct parse_state *state, parse_mb_what_t what, const ch } } + if (state->flags & PHP_HTTP_URL_IGNORE_ERRORS) { + state->buffer[state->offset++] = *ptr; + return 1; + } + return 0; } @@ -824,7 +833,7 @@ static ZEND_RESULT_CODE parse_userinfo(struct parse_state *state, const char *pt break; default: - if ((mb = parse_mb(state, PARSE_USERINFO, ptr, end, tmp, state->flags & PHP_HTTP_URL_SILENT_ERRORS))) { + if ((mb = parse_mb(state, PARSE_USERINFO, ptr, end, tmp, 0))) { ptr += mb - 1; break; } @@ -850,7 +859,7 @@ static ZEND_RESULT_CODE parse_userinfo(struct parse_state *state, const char *pt break; } - } while(++ptr != end); + } while(++ptr < end); state->buffer[state->offset++] = 0; @@ -858,7 +867,7 @@ static ZEND_RESULT_CODE parse_userinfo(struct parse_state *state, const char *pt return SUCCESS; } -#if defined(PHP_WIN32) || defined(HAVE_UIDNA_IDNTOASCII) +#if PHP_WIN32 || HAVE_UIDNA_IDNTOASCII typedef size_t (*parse_mb_func)(unsigned *wc, const char *ptr, const char *end); static ZEND_RESULT_CODE to_utf16(parse_mb_func fn, const char *u8, uint16_t **u16, size_t *len) { @@ -899,11 +908,10 @@ static ZEND_RESULT_CODE to_utf16(parse_mb_func fn, const char *u8, uint16_t **u1 } #endif -#ifndef MAXHOSTNAMELEN -# define MAXHOSTNAMELEN 256 -#endif - #if PHP_HTTP_HAVE_LIBIDN2 +# if __GNUC__ +__attribute__ ((unused)) +# endif static ZEND_RESULT_CODE parse_gidn_2008(struct parse_state *state, size_t prev_len) { char *idn = NULL; @@ -912,7 +920,7 @@ static ZEND_RESULT_CODE parse_gidn_2008(struct parse_state *state, size_t prev_l if (state->flags & PHP_HTTP_URL_PARSE_MBUTF8) { rv = idn2_lookup_u8((const unsigned char *) state->url.host, (unsigned char **) &idn, IDN2_NFC_INPUT); } -# ifdef PHP_HTTP_HAVE_WCHAR +# if PHP_HTTP_HAVE_WCHAR else if (state->flags & PHP_HTTP_URL_PARSE_MBLOC) { rv = idn2_lookup_ul(state->url.host, &idn, 0); } @@ -935,17 +943,20 @@ static ZEND_RESULT_CODE parse_gidn_2008(struct parse_state *state, size_t prev_l #endif #if PHP_HTTP_HAVE_LIBIDN +# if __GNUC__ +__attribute__ ((unused)) +# endif static ZEND_RESULT_CODE parse_gidn_2003(struct parse_state *state, size_t prev_len) { char *idn = NULL; int rv = -1; if (state->flags & PHP_HTTP_URL_PARSE_MBUTF8) { - rv = idna_to_ascii_8z(state->url.host, &idn, IDNA_ALLOW_UNASSIGNED|IDNA_USE_STD3_ASCII_RULES); + rv = idna_to_ascii_8z(state->url.host, &idn, IDNA_ALLOW_UNASSIGNED); } -# ifdef PHP_HTTP_HAVE_WCHAR +# if PHP_HTTP_HAVE_WCHAR else if (state->flags & PHP_HTTP_URL_PARSE_MBLOC) { - rv = idna_to_ascii_lz(state->url.host, &idn, IDNA_ALLOW_UNASSIGNED|IDNA_USE_STD3_ASCII_RULES); + rv = idna_to_ascii_lz(state->url.host, &idn, IDNA_ALLOW_UNASSIGNED); } # endif if (rv != IDNA_SUCCESS) { @@ -965,10 +976,8 @@ static ZEND_RESULT_CODE parse_gidn_2003(struct parse_state *state, size_t prev_l } #endif -#ifdef HAVE_UIDNA_IDNTOASCII -# if PHP_HTTP_HAVE_LIBICU -# include -# else +#if HAVE_UIDNA_IDNTOASCII +# if !PHP_HTTP_HAVE_LIBICU typedef uint16_t UChar; typedef enum { U_ZERO_ERROR = 0 } UErrorCode; int32_t uidna_IDNToASCII(const UChar *src, int32_t srcLength, UChar *dest, int32_t destCapacity, int32_t options, void *parseError, UErrorCode *status); @@ -976,7 +985,7 @@ int32_t uidna_IDNToASCII(const UChar *src, int32_t srcLength, UChar *dest, int32 static ZEND_RESULT_CODE parse_uidn_2003(struct parse_state *state) { char *host_ptr = state->url.host, ebuf[64] = {0}, *error = NULL; - uint16_t *uhost_str, ahost_str[MAXHOSTNAMELEN], *ahost_ptr; + uint16_t *uhost_str, ahost_str[256], *ahost_ptr; size_t uhost_len, ahost_len; UErrorCode rc = U_ZERO_ERROR; @@ -985,7 +994,7 @@ static ZEND_RESULT_CODE parse_uidn_2003(struct parse_state *state) error = "failed to convert to UTF-16"; goto error; } -#ifdef PHP_HTTP_HAVE_WCHAR +#if PHP_HTTP_HAVE_WCHAR } else if (state->flags & PHP_HTTP_URL_PARSE_MBLOC) { if (SUCCESS != to_utf16(parse_mb_loc, state->url.host, &uhost_str, &uhost_len)) { error = "failed to convert to UTF-16"; @@ -997,9 +1006,15 @@ static ZEND_RESULT_CODE parse_uidn_2003(struct parse_state *state) goto error; } - ahost_len = uidna_IDNToASCII(uhost_str, uhost_len, ahost_str, MAXHOSTNAMELEN, 3, NULL, &rc); - efree(uhost_str); +# if __GNUC__ >= 5 +# pragma GCC diagnostic ignored "-Wdeprecated-declarations" +# endif + ahost_len = uidna_IDNToASCII(uhost_str, uhost_len, ahost_str, 256, 3, NULL, &rc); +# if __GNUC__ >= 5 +# pragma GCC diagnostic pop +# endif + efree(uhost_str); if (error > U_ZERO_ERROR) { goto error; } @@ -1022,16 +1037,13 @@ static ZEND_RESULT_CODE parse_uidn_2003(struct parse_state *state) } #endif -#ifdef HAVE_UIDNA_IDNTOASCII -# if PHP_HTTP_HAVE_LIBICU -# include -# endif +#if PHP_HTTP_HAVE_LIBICU && HAVE_UIDNA_NAMETOASCII_UTF8 static ZEND_RESULT_CODE parse_uidn_2008(struct parse_state *state) { char *host_ptr, *error = NULL, ebuf[64] = {0}; UErrorCode rc = U_ZERO_ERROR; UIDNAInfo info = UIDNA_INFO_INITIALIZER; - UIDNA *uidna = uidna_openUTS46(UIDNA_ALLOW_UNASSIGNED|UIDNA_USE_STD3_RULES, &rc); + UIDNA *uidna = uidna_openUTS46(UIDNA_ALLOW_UNASSIGNED, &rc); if (!uidna || U_FAILURE(rc)) { return FAILURE; @@ -1040,16 +1052,16 @@ static ZEND_RESULT_CODE parse_uidn_2008(struct parse_state *state) host_ptr = state->url.host; if (state->flags & PHP_HTTP_URL_PARSE_MBUTF8) { - char ahost_str[MAXHOSTNAMELEN], *ahost_ptr = &ahost_str[0]; + char ahost_str[256], *ahost_ptr = &ahost_str[0]; size_t ahost_len = uidna_nameToASCII_UTF8(uidna, host_ptr, -1, ahost_str, sizeof(ahost_str)-1, &info, &rc); if (U_FAILURE(rc) || info.errors) { goto error; } PHP_HTTP_DUFF(ahost_len, *host_ptr++ = *ahost_ptr++); -#ifdef PHP_HTTP_HAVE_WCHAR +#if PHP_HTTP_HAVE_WCHAR } else if (state->flags & PHP_HTTP_URL_PARSE_MBLOC) { - uint16_t *uhost_str, whost_str[MAXHOSTNAMELEN], *whost_ptr = &whost_str[0]; + uint16_t *uhost_str, whost_str[256], *whost_ptr = &whost_str[0]; size_t uhost_len, whost_len; if (SUCCESS != to_utf16(parse_mb_loc, host_ptr, &uhost_str, &uhost_len)) { @@ -1059,6 +1071,7 @@ static ZEND_RESULT_CODE parse_uidn_2008(struct parse_state *state) whost_len = uidna_nameToASCII(uidna, uhost_str, uhost_len, whost_str, sizeof(whost_str)-1, &info, &rc); whost_ptr = whost_str; + efree(uhost_str); if (U_FAILURE(rc) || info.errors) { goto error; } @@ -1094,11 +1107,48 @@ static ZEND_RESULT_CODE parse_uidn_2008(struct parse_state *state) } #endif -#if 0 && defined(PHP_WIN32) +#if PHP_HTTP_HAVE_LIBIDNKIT || PHP_HTTP_HAVE_LIBIDNKIT2 +# if __GNUC__ +__attribute__ ((unused)) +# endif +static ZEND_RESULT_CODE parse_kidn(struct parse_state *state) +{ + idn_result_t rc; +#if PHP_HTTP_HAVE_LIBIDNKIT + int actions = IDN_DELIMMAP|IDN_LOCALMAP|IDN_NAMEPREP|IDN_IDNCONV|IDN_LENCHECK; +#elif PHP_HTTP_HAVE_LIBIDNKIT2 + int actions = IDN_MAP|IDN_ASCLOWER|IDN_RTCONV|IDN_PROHCHECK|IDN_NFCCHECK|IDN_PREFCHECK|IDN_COMBCHECK|IDN_CTXOLITECHECK|IDN_BIDICHECK|IDN_LOCALCHECK|IDN_IDNCONV|IDN_LENCHECK|IDN_RTCHECK; +#endif + char ahost_str[256] = {0}, *ahost_ptr = &ahost_str[0], *host_ptr = state->url.host; + + if (state->flags & PHP_HTTP_URL_PARSE_MBLOC) { +#if PHP_HTTP_HAVE_LIBIDNKIT + actions |= IDN_LOCALCONV; +#elif PHP_HTTP_HAVE_LIBIDNKIT2 + actions |= IDN_UNICODECONV; +#endif + } + + rc = idn_encodename(actions, state->url.host, ahost_str, 256); + if (rc == idn_success) { + PHP_HTTP_DUFF(strlen(ahost_str), *host_ptr++ = *ahost_ptr++); + + *host_ptr = '\0'; + state->offset += host_ptr - state->url.host; + + return SUCCESS; + } else { + php_error_docref(NULL, E_WARNING, "Failed to parse IDN; %s", idn_result_tostring(rc)); + return FAILURE; + } +} +#endif + +#if 0 && PHP_WIN32 static ZEND_RESULT_CODE parse_widn_2003(struct parse_state *state) { char *host_ptr; - uint16_t *uhost_str, ahost_str[MAXHOSTNAMELEN], *ahost_ptr; + uint16_t *uhost_str, ahost_str[256], *ahost_ptr; size_t uhost_len; if (state->flags & PHP_HTTP_URL_PARSE_MBUTF8) { @@ -1106,7 +1156,7 @@ static ZEND_RESULT_CODE parse_widn_2003(struct parse_state *state) php_error_docref(NULL, E_WARNING, "Failed to parse IDN"); return FAILURE; } -#ifdef PHP_HTTP_HAVE_WCHAR +#if PHP_HTTP_HAVE_WCHAR } else if (state->flags & PHP_HTTP_URL_PARSE_MBLOC) { if (SUCCESS != to_utf16(parse_mb_loc, state->url.host, &uhost_str, &uhost_len)) { php_error_docref(NULL, E_WARNING, "Failed to parse IDN"); @@ -1118,7 +1168,7 @@ static ZEND_RESULT_CODE parse_widn_2003(struct parse_state *state) return FAILURE; } - if (!IdnToAscii(IDN_ALLOW_UNASSIGNED|IDN_USE_STD3_ASCII_RULES, uhost_str, uhost_len, ahost_str, MAXHOSTNAMELEN)) { + if (!IdnToAscii(IDN_ALLOW_UNASSIGNED, uhost_str, uhost_len, ahost_str, 256)) { efree(uhost_str); php_error_docref(NULL, E_WARNING, "Failed to parse IDN"); return FAILURE; @@ -1128,7 +1178,6 @@ static ZEND_RESULT_CODE parse_widn_2003(struct parse_state *state) host_ptr = state->url.host; ahost_ptr = ahost_str; PHP_HTTP_DUFF(wcslen(ahost_str), *host_ptr++ = *ahost_ptr++); - efree(ahost_str); *host_ptr = '\0'; state->offset += host_ptr - state->url.host; @@ -1139,44 +1188,60 @@ static ZEND_RESULT_CODE parse_widn_2003(struct parse_state *state) static ZEND_RESULT_CODE parse_idna(struct parse_state *state, size_t len) { - if ((state->flags & PHP_HTTP_URL_PARSE_TOIDN_2008) - || !(state->flags & PHP_HTTP_URL_PARSE_TOIDN_2003) +#if PHP_HTTP_HAVE_IDNA2008 + if ((state->flags & PHP_HTTP_URL_PARSE_TOIDN_2008) == PHP_HTTP_URL_PARSE_TOIDN_2008 +# if PHP_HTTP_HAVE_IDNA2003 + || (state->flags & PHP_HTTP_URL_PARSE_TOIDN_2003) != PHP_HTTP_URL_PARSE_TOIDN_2003 +# endif ) { -#if HAVE_UIDNA_NAMETOASCII_UTF8 +#if PHP_HTTP_HAVE_LIBICU && HAVE_UIDNA_NAMETOASCII_UTF8 return parse_uidn_2008(state); #elif PHP_HTTP_HAVE_LIBIDN2 return parse_gidn_2008(state, len); +#elif PHP_HTTP_HAVE_LIBIDNKIT2 + return parse_kidn(state); #endif } +#endif - if ((state->flags & PHP_HTTP_URL_PARSE_TOIDN_2003) - || !(state->flags & PHP_HTTP_URL_PARSE_TOIDN_2008) +#if PHP_HTTP_HAVE_IDNA2003 + if ((state->flags & PHP_HTTP_URL_PARSE_TOIDN_2003) == PHP_HTTP_URL_PARSE_TOIDN_2003 +# if PHP_HTTP_HAVE_IDNA2008 + || (state->flags & PHP_HTTP_URL_PARSE_TOIDN_2008) != PHP_HTTP_URL_PARSE_TOIDN_2008 +#endif ) { #if HAVE_UIDNA_IDNTOASCII return parse_uidn_2003(state); #elif PHP_HTTP_HAVE_LIBIDN return parse_gidn_2003(state, len); +#elif PHP_HTTP_HAVE_LIBIDNKIT + return parse_kidn(state); #endif } +#endif -#if 0 && defined(PHP_WIN32) +#if 0 && PHP_WIN32 return parse_widn_2003(state); #endif -#if HAVE_UIDNA_NAMETOASCII_UTF8 +#if PHP_HTTP_HAVE_LIBICU && HAVE_UIDNA_NAMETOASCII_UTF8 return parse_uidn_2008(state); #elif PHP_HTTP_HAVE_LIBIDN2 return parse_gidn_2008(state, len); +#elif PHP_HTTP_HAVE_LIBIDNKIT2 + return parse_kidn(state); #elif HAVE_UIDNA_IDNTOASCII return parse_uidn_2003(state); #elif PHP_HTTP_HAVE_LIBIDN return parse_gidn_2003(state, len); +#elif PHP_HTTP_HAVE_LIBIDNKIT + return parse_kidn(state); #endif return SUCCESS; } -#ifdef HAVE_INET_PTON +#if HAVE_INET_PTON static const char *parse_ip6(struct parse_state *state, const char *ptr) { unsigned pos = 0; @@ -1223,7 +1288,7 @@ static ZEND_RESULT_CODE parse_hostinfo(struct parse_state *state, const char *pt size_t mb, len = state->offset; const char *end = state->ptr, *tmp = ptr, *port = NULL, *label = NULL; -#ifdef HAVE_INET_PTON +#if HAVE_INET_PTON if (*ptr == '[' && !(ptr = parse_ip6(state, ptr))) { if (!(state->flags & PHP_HTTP_URL_IGNORE_ERRORS)) { return FAILURE; @@ -1351,7 +1416,7 @@ static ZEND_RESULT_CODE parse_hostinfo(struct parse_state *state, const char *pt return FAILURE; } break; - } else if (!(mb = parse_mb(state, PARSE_HOSTINFO, ptr, end, tmp, state->flags & PHP_HTTP_URL_SILENT_ERRORS))) { + } else if (!(mb = parse_mb(state, PARSE_HOSTINFO, ptr, end, tmp, 0))) { if (!(state->flags & PHP_HTTP_URL_IGNORE_ERRORS)) { return FAILURE; } @@ -1360,7 +1425,7 @@ static ZEND_RESULT_CODE parse_hostinfo(struct parse_state *state, const char *pt label = ptr; ptr += mb - 1; } - } while (++ptr != end); + } while (++ptr < end); if (!state->url.host) { len = state->offset - len; @@ -1473,7 +1538,7 @@ static const char *parse_path(struct parse_state *state) break; default: - if (!(mb = parse_mb(state, PARSE_PATH, state->ptr, state->end, tmp, state->flags & PHP_HTTP_URL_SILENT_ERRORS))) { + if (!(mb = parse_mb(state, PARSE_PATH, state->ptr, state->end, tmp, 0))) { if (!(state->flags & PHP_HTTP_URL_IGNORE_ERRORS)) { return NULL; } @@ -1563,7 +1628,7 @@ static const char *parse_query(struct parse_state *state) break; default: - if (!(mb = parse_mb(state, PARSE_QUERY, state->ptr, state->end, tmp, state->flags & PHP_HTTP_URL_SILENT_ERRORS))) { + if (!(mb = parse_mb(state, PARSE_QUERY, state->ptr, state->end, tmp, 0))) { if (!(state->flags & PHP_HTTP_URL_IGNORE_ERRORS)) { return NULL; } @@ -1660,7 +1725,7 @@ static const char *parse_fragment(struct parse_state *state) break; default: - if (!(mb = parse_mb(state, PARSE_FRAGMENT, state->ptr, state->end, tmp, state->flags & PHP_HTTP_URL_SILENT_ERRORS))) { + if (!(mb = parse_mb(state, PARSE_FRAGMENT, state->ptr, state->end, tmp, 0))) { if (!(state->flags & PHP_HTTP_URL_IGNORE_ERRORS)) { return NULL; } @@ -1727,7 +1792,7 @@ static const char *parse_scheme(struct parse_state *state) } state->ptr += mb - 1; } - } while (++state->ptr != state->end); + } while (++state->ptr < state->end); softfail: state->offset = 0; @@ -1995,11 +2060,11 @@ PHP_MINIT_FUNCTION(http_url) zend_declare_class_constant_long(php_http_url_class_entry, ZEND_STRL("FROM_ENV"), PHP_HTTP_URL_FROM_ENV); zend_declare_class_constant_long(php_http_url_class_entry, ZEND_STRL("SANITIZE_PATH"), PHP_HTTP_URL_SANITIZE_PATH); -#ifdef PHP_HTTP_HAVE_WCHAR +#if PHP_HTTP_HAVE_WCHAR zend_declare_class_constant_long(php_http_url_class_entry, ZEND_STRL("PARSE_MBLOC"), PHP_HTTP_URL_PARSE_MBLOC); #endif zend_declare_class_constant_long(php_http_url_class_entry, ZEND_STRL("PARSE_MBUTF8"), PHP_HTTP_URL_PARSE_MBUTF8); -#if PHP_HTTP_HAVE_LIBIDN2 || PHP_HTTP_HAVE_LIBIDN || HAVE_UIDNA_IDNTOASCII || HAVE_UIDNA_NAMETOASCII_UTF8 +#if PHP_HTTP_HAVE_LIBIDN2 || PHP_HTTP_HAVE_LIBIDN || PHP_HTTP_HAVE_LIBIDNKIT || PHP_HTTP_HAVE_LIBIDNKIT2 || HAVE_UIDNA_IDNTOASCII || HAVE_UIDNA_NAMETOASCII_UTF8 zend_declare_class_constant_long(php_http_url_class_entry, ZEND_STRL("PARSE_TOIDN"), PHP_HTTP_URL_PARSE_TOIDN); # if PHP_HTTP_HAVE_IDNA2003 zend_declare_class_constant_long(php_http_url_class_entry, ZEND_STRL("PARSE_TOIDN_2003"), PHP_HTTP_URL_PARSE_TOIDN_2003);