update patch 1
This commit is contained in:
+3
-3
@@ -52,14 +52,14 @@ final class FormDataPart extends AbstractMultipartPart
|
||||
$prepare = function ($item, $key, $root = null) use (&$values, &$prepare) {
|
||||
if (null === $root && \is_int($key) && \is_array($item)) {
|
||||
if (1 !== \count($item)) {
|
||||
throw new InvalidArgumentException(sprintf('Form field values with integer keys can only have one array element, the key being the field name and the value being the field value, %d provided.', \count($item)));
|
||||
throw new InvalidArgumentException(\sprintf('Form field values with integer keys can only have one array element, the key being the field name and the value being the field value, %d provided.', \count($item)));
|
||||
}
|
||||
|
||||
$key = key($item);
|
||||
$item = $item[$key];
|
||||
}
|
||||
|
||||
$fieldName = null !== $root ? sprintf('%s[%s]', $root, $key) : $key;
|
||||
$fieldName = null !== $root ? \sprintf('%s[%s]', $root, $key) : $key;
|
||||
|
||||
if (\is_array($item)) {
|
||||
array_walk($item, $prepare, $fieldName);
|
||||
@@ -68,7 +68,7 @@ final class FormDataPart extends AbstractMultipartPart
|
||||
}
|
||||
|
||||
if (!\is_string($item) && !$item instanceof TextPart) {
|
||||
throw new InvalidArgumentException(sprintf('The value of the form field "%s" can only be a string, an array, or an instance of TextPart, "%s" given.', $fieldName, get_debug_type($item)));
|
||||
throw new InvalidArgumentException(\sprintf('The value of the form field "%s" can only be a string, an array, or an instance of TextPart, "%s" given.', $fieldName, get_debug_type($item)));
|
||||
}
|
||||
|
||||
$values[] = $this->preparePart($fieldName, $item);
|
||||
|
||||
Reference in New Issue
Block a user