diff --git a/core/modules/aggregator/src/Form/OpmlFeedAdd.php b/core/modules/aggregator/src/Form/OpmlFeedAdd.php index d084bff..0ba285a 100644 --- a/core/modules/aggregator/src/Form/OpmlFeedAdd.php +++ b/core/modules/aggregator/src/Form/OpmlFeedAdd.php @@ -99,8 +99,8 @@ public function buildForm(array $form, FormStateInterface $form_state) { */ public function validateForm(array &$form, FormStateInterface $form_state) { // If both fields are empty or filled, cancel. - $file_upload = $this->getRequest()->files->get('files[upload]', NULL, TRUE); - if ($form_state->isValueEmpty('remote') == empty($file_upload)) { + $all_files = $this->getRequest()->files->get('files', []); + if ($form_state->isValueEmpty('remote') == empty($all_files['upload'])) { $form_state->setErrorByName('remote', $this->t('Either upload a file or enter a URL.')); } } diff --git a/core/modules/config/src/Form/ConfigImportForm.php b/core/modules/config/src/Form/ConfigImportForm.php index c0f606b..f95b7a5 100644 --- a/core/modules/config/src/Form/ConfigImportForm.php +++ b/core/modules/config/src/Form/ConfigImportForm.php @@ -67,13 +67,16 @@ public function buildForm(array $form, FormStateInterface $form_state) { * {@inheritdoc} */ public function validateForm(array &$form, FormStateInterface $form_state) { - $file_upload = $this->getRequest()->files->get('files[import_tarball]', NULL, TRUE); - if ($file_upload && $file_upload->isValid()) { - $form_state->setValue('import_tarball', $file_upload->getRealPath()); - } - else { - $form_state->setErrorByName('import_tarball', $this->t('The file could not be uploaded.')); + $all_files = $this->getRequest()->files->get('files', []); + if (!empty($all_files['import_tarball'])) { + $file_upload = $all_files['import_tarball']; + if ($file_upload->isValid()) { + $form_state->setValue('import_tarball', $file_upload->getRealPath()); + return; + } } + + $form_state->setErrorByName('import_tarball', $this->t('The file could not be uploaded.')); } /** diff --git a/core/modules/file/file.module b/core/modules/file/file.module index 0e5b057..bbf3bff 100644 --- a/core/modules/file/file.module +++ b/core/modules/file/file.module @@ -709,11 +709,12 @@ function file_save_upload($form_field_name, $validators = array(), $destination $user = \Drupal::currentUser(); static $upload_cache; - $file_upload = \Drupal::request()->files->get("files[$form_field_name]", NULL, TRUE); + $all_files = \Drupal::request()->files->get('files', array()); // Make sure there's an upload to process. - if (empty($file_upload)) { + if (empty($all_files[$form_field_name])) { return NULL; } + $file_upload = $all_files[$form_field_name]; // Return cached objects without processing since the file will have // already been processed and the paths in $_FILES will be invalid. @@ -1168,10 +1169,11 @@ function file_managed_file_submit($form, FormStateInterface $form_state) { */ function file_managed_file_save_upload($element, FormStateInterface $form_state) { $upload_name = implode('_', $element['#parents']); - $file_upload = \Drupal::request()->files->get("files[$upload_name]", NULL, TRUE); - if (empty($file_upload)) { + $all_files = \Drupal::request()->files->get('files', array()); + if (empty($all_files[$upload_name])) { return FALSE; } + $file_upload = $all_files[$upload_name]; $destination = isset($element['#upload_location']) ? $element['#upload_location'] : NULL; if (isset($destination) && !file_prepare_directory($destination, FILE_CREATE_DIRECTORY)) { diff --git a/core/modules/link/src/Plugin/Validation/Constraint/LinkAccessConstraintValidator.php b/core/modules/link/src/Plugin/Validation/Constraint/LinkAccessConstraintValidator.php index f2a5f83..b4be911 100644 --- a/core/modules/link/src/Plugin/Validation/Constraint/LinkAccessConstraintValidator.php +++ b/core/modules/link/src/Plugin/Validation/Constraint/LinkAccessConstraintValidator.php @@ -7,7 +7,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\ConstraintValidatorInterface; -use Symfony\Component\Validator\ExecutionContextInterface; +use Symfony\Component\Validator\Context\ExecutionContextInterface; /** * Validates the LinkAccess constraint. @@ -17,7 +17,7 @@ class LinkAccessConstraintValidator implements ConstraintValidatorInterface, Con /** * Stores the validator's state during validation. * - * @var \Symfony\Component\Validator\ExecutionContextInterface + * @var \Symfony\Component\Validator\Context\ExecutionContextInterface */ protected $context; diff --git a/core/modules/link/src/Plugin/Validation/Constraint/LinkExternalProtocolsConstraintValidator.php b/core/modules/link/src/Plugin/Validation/Constraint/LinkExternalProtocolsConstraintValidator.php index e85de58..8934c31 100644 --- a/core/modules/link/src/Plugin/Validation/Constraint/LinkExternalProtocolsConstraintValidator.php +++ b/core/modules/link/src/Plugin/Validation/Constraint/LinkExternalProtocolsConstraintValidator.php @@ -5,7 +5,7 @@ use Drupal\Component\Utility\UrlHelper; use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\ConstraintValidatorInterface; -use Symfony\Component\Validator\ExecutionContextInterface; +use Symfony\Component\Validator\Context\ExecutionContextInterface; /** * Validates the LinkExternalProtocols constraint. @@ -15,7 +15,7 @@ class LinkExternalProtocolsConstraintValidator implements ConstraintValidatorInt /** * Stores the validator's state during validation. * - * @var \Symfony\Component\Validator\ExecutionContextInterface + * @var \Symfony\Component\Validator\Context\ExecutionContextInterface */ protected $context; diff --git a/core/modules/link/src/Plugin/Validation/Constraint/LinkNotExistingInternalConstraintValidator.php b/core/modules/link/src/Plugin/Validation/Constraint/LinkNotExistingInternalConstraintValidator.php index 86c3866..c68069b 100644 --- a/core/modules/link/src/Plugin/Validation/Constraint/LinkNotExistingInternalConstraintValidator.php +++ b/core/modules/link/src/Plugin/Validation/Constraint/LinkNotExistingInternalConstraintValidator.php @@ -7,7 +7,7 @@ use Symfony\Component\Routing\Exception\RouteNotFoundException; use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\ConstraintValidatorInterface; -use Symfony\Component\Validator\ExecutionContextInterface; +use Symfony\Component\Validator\Context\ExecutionContextInterface; /** * Validates the LinkNotExistingInternal constraint. @@ -17,7 +17,7 @@ class LinkNotExistingInternalConstraintValidator implements ConstraintValidatorI /** * Stores the validator's state during validation. * - * @var \Symfony\Component\Validator\ExecutionContextInterface + * @var \Symfony\Component\Validator\Context\ExecutionContextInterface */ protected $context; diff --git a/core/modules/link/src/Plugin/Validation/Constraint/LinkTypeConstraint.php b/core/modules/link/src/Plugin/Validation/Constraint/LinkTypeConstraint.php index 3fe76a6..f2010fa 100644 --- a/core/modules/link/src/Plugin/Validation/Constraint/LinkTypeConstraint.php +++ b/core/modules/link/src/Plugin/Validation/Constraint/LinkTypeConstraint.php @@ -5,7 +5,7 @@ use Drupal\link\LinkItemInterface; use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\ConstraintValidatorInterface; -use Symfony\Component\Validator\ExecutionContextInterface; +use Symfony\Component\Validator\Context\ExecutionContextInterface; /** * Validation constraint for links receiving data allowed by its settings. @@ -20,7 +20,7 @@ class LinkTypeConstraint extends Constraint implements ConstraintValidatorInterf public $message = "The path '@uri' is invalid."; /** - * @var \Symfony\Component\Validator\ExecutionContextInterface + * @var \Symfony\Component\Validator\Context\ExecutionContextInterface */ protected $context; diff --git a/core/modules/link/tests/src/Unit/Plugin/Validation/Constraint/LinkAccessConstraintValidatorTest.php b/core/modules/link/tests/src/Unit/Plugin/Validation/Constraint/LinkAccessConstraintValidatorTest.php index 9e4623e..8271c59 100644 --- a/core/modules/link/tests/src/Unit/Plugin/Validation/Constraint/LinkAccessConstraintValidatorTest.php +++ b/core/modules/link/tests/src/Unit/Plugin/Validation/Constraint/LinkAccessConstraintValidatorTest.php @@ -29,7 +29,7 @@ class LinkAccessConstraintValidatorTest extends UnitTestCase { * @dataProvider providerValidate */ public function testValidate($value, $user, $valid) { - $context = $this->getMock('Symfony\Component\Validator\ExecutionContextInterface'); + $context = $this->getMock('Symfony\Component\Validator\Context\ExecutionContextInterface'); if ($valid) { $context->expects($this->never()) diff --git a/core/modules/link/tests/src/Unit/Plugin/Validation/Constraint/LinkExternalProtocolsConstraintValidatorTest.php b/core/modules/link/tests/src/Unit/Plugin/Validation/Constraint/LinkExternalProtocolsConstraintValidatorTest.php index 771b307..a326b57 100644 --- a/core/modules/link/tests/src/Unit/Plugin/Validation/Constraint/LinkExternalProtocolsConstraintValidatorTest.php +++ b/core/modules/link/tests/src/Unit/Plugin/Validation/Constraint/LinkExternalProtocolsConstraintValidatorTest.php @@ -19,7 +19,7 @@ class LinkExternalProtocolsConstraintValidatorTest extends UnitTestCase { * @dataProvider providerValidate */ public function testValidate($value, $valid) { - $context = $this->getMock('Symfony\Component\Validator\ExecutionContextInterface'); + $context = $this->getMock('Symfony\Component\Validator\Context\ExecutionContextInterface'); if ($valid) { $context->expects($this->never()) @@ -77,7 +77,7 @@ public function testValidateWithMalformedUri() { ->method('getUrl') ->willThrowException(new \InvalidArgumentException()); - $context = $this->getMock('Symfony\Component\Validator\ExecutionContextInterface'); + $context = $this->getMock('Symfony\Component\Validator\Context\ExecutionContextInterface'); $context->expects($this->never()) ->method('addViolation'); @@ -97,7 +97,7 @@ public function testValidateIgnoresInternalUrls() { ->method('getUrl') ->willReturn(Url::fromRoute('example.test')); - $context = $this->getMock('Symfony\Component\Validator\ExecutionContextInterface'); + $context = $this->getMock('Symfony\Component\Validator\Context\ExecutionContextInterface'); $context->expects($this->never()) ->method('addViolation'); diff --git a/core/modules/link/tests/src/Unit/Plugin/Validation/Constraint/LinkNotExistingInternalConstraintValidatorTest.php b/core/modules/link/tests/src/Unit/Plugin/Validation/Constraint/LinkNotExistingInternalConstraintValidatorTest.php index 69776fd..2f0f7b5 100644 --- a/core/modules/link/tests/src/Unit/Plugin/Validation/Constraint/LinkNotExistingInternalConstraintValidatorTest.php +++ b/core/modules/link/tests/src/Unit/Plugin/Validation/Constraint/LinkNotExistingInternalConstraintValidatorTest.php @@ -19,7 +19,7 @@ class LinkNotExistingInternalConstraintValidatorTest extends UnitTestCase { * @dataProvider providerValidate */ public function testValidate($value, $valid) { - $context = $this->getMock('Symfony\Component\Validator\ExecutionContextInterface'); + $context = $this->getMock('Symfony\Component\Validator\Context\ExecutionContextInterface'); if ($valid) { $context->expects($this->never()) @@ -94,7 +94,7 @@ public function testValidateWithMalformedUri() { ->method('getUrl') ->willThrowException(new \InvalidArgumentException()); - $context = $this->getMock('Symfony\Component\Validator\ExecutionContextInterface'); + $context = $this->getMock('Symfony\Component\Validator\Context\ExecutionContextInterface'); $context->expects($this->never()) ->method('addViolation'); diff --git a/core/modules/update/src/Form/UpdateManagerInstall.php b/core/modules/update/src/Form/UpdateManagerInstall.php index 5524f9e..f06b53a 100644 --- a/core/modules/update/src/Form/UpdateManagerInstall.php +++ b/core/modules/update/src/Form/UpdateManagerInstall.php @@ -122,8 +122,8 @@ public function buildForm(array $form, FormStateInterface $form_state) { * {@inheritdoc} */ public function validateForm(array &$form, FormStateInterface $form_state) { - $uploaded_file = $this->getRequest()->files->get('files[project_upload]', NULL, TRUE); - if (!($form_state->getValue('project_url') xor !empty($uploaded_file))) { + $all_files = $this->getRequest()->files->get('files', []); + if (!($form_state->getValue('project_url') xor !empty($all_files['project_upload']))) { $form_state->setErrorByName('project_url', $this->t('You must either provide a URL or upload an archive file to install.')); } } diff --git a/core/modules/user/src/Plugin/Validation/Constraint/UserMailRequired.php b/core/modules/user/src/Plugin/Validation/Constraint/UserMailRequired.php index 5905e12..246628a 100644 --- a/core/modules/user/src/Plugin/Validation/Constraint/UserMailRequired.php +++ b/core/modules/user/src/Plugin/Validation/Constraint/UserMailRequired.php @@ -4,7 +4,7 @@ use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\ConstraintValidatorInterface; -use Symfony\Component\Validator\ExecutionContextInterface; +use Symfony\Component\Validator\Context\ExecutionContextInterface; /** * Checks if the user's email address is provided if required. @@ -31,7 +31,7 @@ class UserMailRequired extends Constraint implements ConstraintValidatorInterfac public $message = '@name field is required.'; /** - * @var \Symfony\Component\Validator\ExecutionContextInterface + * @var \Symfony\Component\Validator\Context\ExecutionContextInterface */ protected $context; diff --git a/core/modules/user/tests/src/Unit/Plugin/Validation/Constraint/ProtectedUserFieldConstraintValidatorTest.php b/core/modules/user/tests/src/Unit/Plugin/Validation/Constraint/ProtectedUserFieldConstraintValidatorTest.php index d29c8c5..0370461 100644 --- a/core/modules/user/tests/src/Unit/Plugin/Validation/Constraint/ProtectedUserFieldConstraintValidatorTest.php +++ b/core/modules/user/tests/src/Unit/Plugin/Validation/Constraint/ProtectedUserFieldConstraintValidatorTest.php @@ -47,7 +47,7 @@ public function testValidate($items, $expected_violation, $name = FALSE) { // If a violation is expected, then the context's addViolation method will // be called, otherwise it should not be called. - $context = $this->getMock('Symfony\Component\Validator\ExecutionContextInterface'); + $context = $this->getMock('Symfony\Component\Validator\Context\ExecutionContextInterface'); if ($expected_violation) { $context->expects($this->once())