Skip to content

Commit eceacc6

Browse files
committed
Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4: Fix MIME charset sniffing advancing by name length not value length
2 parents 235b9b5 + 98563c2 commit eceacc6

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

ext/dom/tests/modern/html/encoding/HTMLDocument_createFromFile_http_header.phpt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ $tests = [
4646
"text/html; ;; ; ;; Charset=\"ISO-8859-1\"",
4747
"text/html;Charset=\"ISO-8859-1",
4848
"tex.t/h#\$%!&'*%2B-.^_`|~tml;Charset=\"ISO-8859-1\"", // Note: have to encode + as 2B because of implementation details of http_server()
49+
"text/html; abcd=ef;charset=ISO-8859-1",
4950
],
5051
"Valid input, but invalid encoding name" => [
5152
"text/html;Charset=\"ISO-8859-1\\",
@@ -100,6 +101,7 @@ foreach ($tests as $name => $headers) {
100101
äöü
101102
äöü
102103
äöü
104+
äöü
103105
--- Valid input, but invalid encoding name ---
104106
���
105107
���

ext/libxml/mime_sniff.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ PHP_LIBXML_API zend_string *php_libxml_sniff_charset_from_string(const char *sta
273273
/* 11.9.1. Set parameterValue to the result of collecting a sequence of code points that are not ';' */
274274
size_t parameter_value_length = collect_a_sequence_of_code_points(start, end, is_not_semicolon);
275275
parameter_value = zend_string_init(start, parameter_value_length, false);
276-
start += parameter_name_length;
276+
start += parameter_value_length;
277277

278278
/* 11.9.2. Remove trailing HTTP whitespace from parameterValue */
279279
while (ZSTR_LEN(parameter_value) > 0 && is_http_whitespace(ZSTR_VAL(parameter_value)[ZSTR_LEN(parameter_value) - 1])) {

0 commit comments

Comments
 (0)