Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ http_server_skipif();
require "./ext/standard/tests/http/server.inc";

$tests = [
"No slashes" => [
"foo",
" ",
],
"Invalid type/subtype" => [
"/html; Charset=\"ISO-8859-1\"",
"text/; Charset=\"ISO-8859-1\"",
Expand All @@ -32,6 +36,8 @@ $tests = [
"All valid inputs" => [
"text/html; charset=ISO-8859-1",
"\t\r text/html; charset=ISO-8859-1 \t",
"\t\r text/html; charset=ISO-8859-1 \t;bar=\"foo\"",
"\t\r text/html; charset=ISO-8859-1 \t;bar=\"foo\"\r\n\t ",
"text/html; foo=bar;charset=ISO-8859-1",
"text/html; foo=bar;charset=ISO-8859-1;bar=\"foooooo\"",
"text/html;;;; charset=ISO-8859-1",
Expand All @@ -45,6 +51,7 @@ $tests = [
"text/html;Charset=\"ISO-8859-1\\",
"text/html;Charset=\"ISO-8859-1\\\"",
"text/html;Charset=\"foobar\\\"",
"text/html;Charset=\"%7F\\\"",
"text/html;Charset=\"\\\"",
"text/html;Charset=",
],
Expand All @@ -62,6 +69,9 @@ foreach ($tests as $name => $headers) {
}
?>
--EXPECT--
--- No slashes ---
���
���
--- Invalid type/subtype ---
���
���
Expand All @@ -88,9 +98,12 @@ foreach ($tests as $name => $headers) {
äöü
äöü
äöü
äöü
äöü
--- Valid input, but invalid encoding name ---
���
���
���
���
���
���
2 changes: 1 addition & 1 deletion ext/libxml/mime_sniff.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ PHP_LIBXML_API zend_string *php_libxml_sniff_charset_from_string(const char *sta
while (start < end && is_http_whitespace(*start)) {
start++;
}
while (start < end && is_http_whitespace(*end)) {
while (start < end && is_http_whitespace(*(end - 1))) {
end--;
}

Expand Down