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;
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'",
}
}
+ if (state->flags & PHP_HTTP_URL_IGNORE_ERRORS) {
+ state->buffer[state->offset++] = *ptr;
+ return 1;
+ }
+
return 0;
}
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;
}
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;
}
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;
}
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;
}
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;
}