diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Tests/ImportOpmlTest.php b/core/modules/aggregator/lib/Drupal/aggregator/Tests/ImportOpmlTest.php index 7a9f463..631bc6e 100644 --- a/core/modules/aggregator/lib/Drupal/aggregator/Tests/ImportOpmlTest.php +++ b/core/modules/aggregator/lib/Drupal/aggregator/Tests/ImportOpmlTest.php @@ -53,7 +53,7 @@ function openImportForm() { $this->drupalGet('admin/config/services/aggregator/add/opml'); $this->assertText('A single OPML document may contain a collection of many feeds.', 'Found OPML help text.'); - $this->assertField('files[upload]', 'Found file upload field.'); + $this->assertField('files[upload][]', 'Found file upload field.'); $this->assertField('remote', 'Found Remote URL field.'); $this->assertField('refresh', '', 'Found Refresh field.'); $this->assertFieldByName("category[$cid]", $cid, 'Found category field.'); @@ -71,7 +71,7 @@ function validateImportFormFields() { $path = $this->getEmptyOpml(); $edit = array( - 'files[upload]' => $path, + 'files[upload][]' => $path, 'remote' => file_create_url($path), ); $this->drupalPost('admin/config/services/aggregator/add/opml', $edit, t('Import')); @@ -91,7 +91,7 @@ function validateImportFormFields() { function submitImportForm() { $before = db_query('SELECT COUNT(*) FROM {aggregator_feed}')->fetchField(); - $form['files[upload]'] = $this->getInvalidOpml(); + $form['files[upload][]'] = $this->getInvalidOpml(); $this->drupalPost('admin/config/services/aggregator/add/opml', $form, t('Import')); $this->assertText(t('No new feed has been added.'), 'Attempting to upload invalid XML.'); @@ -119,7 +119,7 @@ function submitImportForm() { $feeds[1] = $this->getFeedEditArray(); $feeds[2] = $this->getFeedEditArray(); $edit = array( - 'files[upload]' => $this->getValidOpml($feeds), + 'files[upload][]' => $this->getValidOpml($feeds), 'refresh' => '900', 'category[1]' => $category, ); diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentPreviewTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentPreviewTest.php index 13817df..d7ec0b4 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentPreviewTest.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentPreviewTest.php @@ -48,7 +48,7 @@ function testCommentPreview() { $edit['signature[value]'] = '' . $test_signature. ''; $edit['signature[format]'] = 'filtered_html'; $image = current($this->drupalGetTestFiles('image')); - $edit['files[user_picture_und_0]'] = drupal_realpath($image->uri); + $edit['files[user_picture_und_0][]'] = drupal_realpath($image->uri); $this->drupalPost('user/' . $this->web_user->uid . '/edit', $edit, t('Save')); // As the web user, fill in the comment form and preview the comment. diff --git a/core/modules/file/file.module b/core/modules/file/file.module index e1bf021..c21aa1c 100644 --- a/core/modules/file/file.module +++ b/core/modules/file/file.module @@ -1228,7 +1228,7 @@ function file_managed_file_save_upload($element) { $files = array_filter($files); $fids = array_map(function($file) {return $file->fid;}, $files); - return array_combine($fids, $files); + return empty($files) ? array() : array_combine($fids, $files); } return array(); diff --git a/core/modules/locale/lib/Drupal/locale/Tests/LocaleExportTest.php b/core/modules/locale/lib/Drupal/locale/Tests/LocaleExportTest.php index 7ae1bf7..4f2748b 100644 --- a/core/modules/locale/lib/Drupal/locale/Tests/LocaleExportTest.php +++ b/core/modules/locale/lib/Drupal/locale/Tests/LocaleExportTest.php @@ -55,7 +55,7 @@ function testExportTranslation() { file_put_contents($name, $this->getPoFile()); $this->drupalPost('admin/config/regional/translate/import', array( 'langcode' => 'fr', - 'files[file]' => $name, + 'files[file][]' => $name, ), t('Import')); drupal_unlink($name); @@ -74,7 +74,7 @@ function testExportTranslation() { file_put_contents($name, $this->getCustomPoFile()); $this->drupalPost('admin/config/regional/translate/import', array( 'langcode' => 'fr', - 'files[file]' => $name, + 'files[file][]' => $name, 'customized' => 1, ), t('Import')); drupal_unlink($name); diff --git a/core/modules/locale/lib/Drupal/locale/Tests/LocaleImportFunctionalTest.php b/core/modules/locale/lib/Drupal/locale/Tests/LocaleImportFunctionalTest.php index fd3667c..dcd7bf2 100644 --- a/core/modules/locale/lib/Drupal/locale/Tests/LocaleImportFunctionalTest.php +++ b/core/modules/locale/lib/Drupal/locale/Tests/LocaleImportFunctionalTest.php @@ -91,7 +91,7 @@ function testStandalonePoFile() { $name = $this->randomName(16); $this->drupalPost('admin/config/regional/translate/import', array( 'langcode' => 'fr', - 'files[file]' => $name, + 'files[file][]' => $name, ), t('Import')); $this->assertEqual($this->getUrl(), url('admin/config/regional/translate/import', array('absolute' => TRUE)), t('Correct page redirection.')); $this->assertText(t('File to import not found.'), t('File to import not found message.')); @@ -248,7 +248,7 @@ function testEmptyMsgstr() { function importPoFile($contents, array $options = array()) { $name = tempnam('temporary://', "po_") . '.po'; file_put_contents($name, $contents); - $options['files[file]'] = $name; + $options['files[file][]'] = $name; $this->drupalPost('admin/config/regional/translate/import', $options, t('Import')); drupal_unlink($name); } diff --git a/core/modules/locale/lib/Drupal/locale/Tests/LocalePluralFormatTest.php b/core/modules/locale/lib/Drupal/locale/Tests/LocalePluralFormatTest.php index 8119199..069dc4e 100644 --- a/core/modules/locale/lib/Drupal/locale/Tests/LocalePluralFormatTest.php +++ b/core/modules/locale/lib/Drupal/locale/Tests/LocalePluralFormatTest.php @@ -268,7 +268,7 @@ function testPluralEditExport() { function importPoFile($contents, array $options = array()) { $name = tempnam('temporary://', "po_") . '.po'; file_put_contents($name, $contents); - $options['files[file]'] = $name; + $options['files[file][]'] = $name; $this->drupalPost('admin/config/regional/translate/import', $options, t('Import')); drupal_unlink($name); } diff --git a/core/modules/rdf/lib/Drupal/rdf/Tests/RdfaMarkupTest.php b/core/modules/rdf/lib/Drupal/rdf/Tests/RdfaMarkupTest.php index 6f99dae..589ad4b 100644 --- a/core/modules/rdf/lib/Drupal/rdf/Tests/RdfaMarkupTest.php +++ b/core/modules/rdf/lib/Drupal/rdf/Tests/RdfaMarkupTest.php @@ -139,8 +139,8 @@ function testAttributesInMarkupFile() { // Create an array for drupalPost with the field names as the keys and // the URIs for the test files as the values. - $edit = array("files[" . $field_name . "_" . $langcode . "_0]" => drupal_realpath($file->uri), - "files[" . $image_field . "_" . $langcode . "_0]" => drupal_realpath($image->uri)); + $edit = array("files[" . $field_name . "_" . $langcode . "_0][]" => drupal_realpath($file->uri), + "files[" . $image_field . "_" . $langcode . "_0][]" => drupal_realpath($image->uri)); // Create node and save, then edit node to upload files. $node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1)); diff --git a/core/modules/system/lib/Drupal/system/Tests/Form/StateValuesCleanAdvancedTest.php b/core/modules/system/lib/Drupal/system/Tests/Form/StateValuesCleanAdvancedTest.php index ceae2af..b7c8e22 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Form/StateValuesCleanAdvancedTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Form/StateValuesCleanAdvancedTest.php @@ -47,7 +47,7 @@ function testFormStateValuesCleanAdvanced() { $this->assertTrue(is_file($this->image->uri), "The image file we're going to upload exists."); // "Browse" for the desired file. - $edit = array('files[image]' => drupal_realpath($this->image->uri)); + $edit = array('files[image][]' => drupal_realpath($this->image->uri)); // Post the form. $this->drupalPost('form_test/form-state-values-clean-advanced', $edit, t('Submit')); diff --git a/core/modules/system/lib/Drupal/system/Tests/System/ThemeTest.php b/core/modules/system/lib/Drupal/system/Tests/System/ThemeTest.php index 111e6b7..7e335e2 100644 --- a/core/modules/system/lib/Drupal/system/Tests/System/ThemeTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/System/ThemeTest.php @@ -156,7 +156,7 @@ function testThemeSettings() { $edit = array( 'default_logo' => FALSE, 'logo_path' => '', - 'files[logo_upload]' => drupal_realpath($file->uri), + 'files[logo_upload][]' => drupal_realpath($file->uri), ); $this->drupalPost('admin/appearance/settings', $edit, t('Save configuration')); diff --git a/core/modules/update/lib/Drupal/update/Tests/UpdateUploadTest.php b/core/modules/update/lib/Drupal/update/Tests/UpdateUploadTest.php index d3bcdb8..0a8db21 100644 --- a/core/modules/update/lib/Drupal/update/Tests/UpdateUploadTest.php +++ b/core/modules/update/lib/Drupal/update/Tests/UpdateUploadTest.php @@ -44,7 +44,7 @@ public function testUploadModule() { $imageTestFiles = $this->drupalGetTestFiles('image'); $invalidArchiveFile = reset($imageTestFiles); $edit = array( - 'files[project_upload]' => $invalidArchiveFile->uri, + 'files[project_upload][]' => $invalidArchiveFile->uri, ); // This also checks that the correct archive extensions are allowed. $this->drupalPost('admin/modules/install', $edit, t('Install')); @@ -55,7 +55,7 @@ public function testUploadModule() { // installed until after extraction. $validArchiveFile = drupal_get_path('module', 'update') . '/tests/aaa_update_test.tar.gz'; $edit = array( - 'files[project_upload]' => $validArchiveFile, + 'files[project_upload][]' => $validArchiveFile, ); $this->drupalPost('admin/modules/install', $edit, t('Install')); $this->assertText(t('@module_name is already installed.', array('@module_name' => 'AAA Update test')), 'Existing module was extracted and not reinstalled.'); diff --git a/core/modules/user/lib/Drupal/user/Tests/UserPictureTest.php b/core/modules/user/lib/Drupal/user/Tests/UserPictureTest.php index 8447031..fde2fbc 100644 --- a/core/modules/user/lib/Drupal/user/Tests/UserPictureTest.php +++ b/core/modules/user/lib/Drupal/user/Tests/UserPictureTest.php @@ -117,7 +117,7 @@ function testPictureOnNodeComment() { * Edits the user picture for the test user. */ function saveUserPicture($image) { - $edit = array('files[user_picture_und_0]' => drupal_realpath($image->uri)); + $edit = array('files[user_picture_und_0][]' => drupal_realpath($image->uri)); $this->drupalPost('user/' . $this->web_user->uid . '/edit', $edit, t('Save')); // Load actual user data from database.