mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-03 05:48:11 +08:00
Fix #18313: Fix multipart form data parse with double quotes
This commit is contained in:
@ -141,10 +141,11 @@ class MultipartFormDataParser extends BaseObject implements RequestParserInterfa
|
||||
return [];
|
||||
}
|
||||
|
||||
if (!preg_match('/boundary=(.*)$/is', $contentType, $matches)) {
|
||||
if (!preg_match('/boundary="?(.*)"?$/is', $contentType, $matches)) {
|
||||
return [];
|
||||
}
|
||||
$boundary = $matches[1];
|
||||
|
||||
$boundary = trim($matches[1], '"');
|
||||
|
||||
$bodyParts = preg_split('/\\R?-+' . preg_quote($boundary, '/') . '/s', $rawBody);
|
||||
array_pop($bodyParts); // last block always has no data, contains boundary ending like `--`
|
||||
|
||||
Reference in New Issue
Block a user