diff --git a/main/rfc1867.c b/main/rfc1867.c index e7c228a79be4..2f7c6110b459 100644 --- a/main/rfc1867.c +++ b/main/rfc1867.c @@ -693,7 +693,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) int boundary_len = 0, cancel_upload = 0, is_arr_upload = 0; size_t array_len = 0; int64_t total_bytes = 0, max_file_size = 0; - int skip_upload = 0, anonymous_index = 0; + int anonymous_index = 0; multipart_buffer *mbuff; zval *array_ptr = (zval *) arg; bool throw_exceptions = SG(request_parse_body_context).throw_exceptions; @@ -822,6 +822,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) char *cd = NULL, *param = NULL, *filename = NULL, *tmp = NULL; size_t blen = 0, wlen = 0; zend_off_t offset; + int skip_upload = 0; zend_llist_clean(&header); diff --git a/tests/basic/rfc1867_malformed_bracket_skip_upload.phpt b/tests/basic/rfc1867_malformed_bracket_skip_upload.phpt new file mode 100644 index 000000000000..1fcbb1f748c3 --- /dev/null +++ b/tests/basic/rfc1867_malformed_bracket_skip_upload.phpt @@ -0,0 +1,39 @@ +--TEST-- +rfc1867: malformed bracket in one file part name does not skip subsequent valid file uploads +--INI-- +file_uploads=1 +--POST_RAW-- +Content-Type: multipart/form-data; boundary=----PhpTestBoundaryH8 +------PhpTestBoundaryH8 +Content-Disposition: form-data; name="bad["; filename="bad.txt" +Content-Type: text/plain + +bad-body +------PhpTestBoundaryH8 +Content-Disposition: form-data; name="good"; filename="good.txt" +Content-Type: text/plain + +good-body +------PhpTestBoundaryH8 +Content-Disposition: form-data; name="field_after" + +ok +------PhpTestBoundaryH8-- +--FILE-- + +--EXPECT-- +array(1) { + [0]=> + string(11) "field_after" +} +array(1) { + [0]=> + string(4) "good" +} +string(8) "good.txt" +int(9)