diff --git a/core/modules/file/file.install b/core/modules/file/file.install index 3ca855e..4a384c1 100644 --- a/core/modules/file/file.install +++ b/core/modules/file/file.install @@ -197,8 +197,9 @@ function file_requirements($phase) { // Check the server's ability to indicate upload progress. if ($phase == 'runtime') { $implementation = file_progress_implementation(); - $apache = strpos($_SERVER['SERVER_SOFTWARE'], 'Apache') !== FALSE; - $fastcgi = strpos($_SERVER['SERVER_SOFTWARE'], 'mod_fastcgi') !== FALSE || strpos($_SERVER["SERVER_SOFTWARE"], 'mod_fcgi') !== FALSE; + $software = Drupal::request()->server->get('SERVER_SOFTWARE') + $apache = strpos($software, 'Apache') !== FALSE; + $fastcgi = strpos($software, 'mod_fastcgi') !== FALSE || strpos($software, 'mod_fcgi') !== FALSE; $description = NULL; if (!$apache) { $value = t('Not enabled'); diff --git a/core/modules/file/file.module b/core/modules/file/file.module index 18dae26..e0286ca 100644 --- a/core/modules/file/file.module +++ b/core/modules/file/file.module @@ -738,8 +738,8 @@ function file_cron() { function file_ajax_upload() { $form_parents = func_get_args(); $form_build_id = (string) array_pop($form_parents); - - if (empty($_POST['form_build_id']) || $form_build_id != $_POST['form_build_id']) { + $request = Drupal::request()->request->get('form_build_id'); + if (empty($request) || $form_build_id != $request) { // Invalid request. drupal_set_message(t('An unrecoverable error occurred. The uploaded file likely exceeded the maximum file size (@size) that this server supports.', array('@size' => format_size(file_upload_max_size()))), 'error'); $response = new AjaxResponse(); @@ -1178,7 +1178,8 @@ function file_managed_file_submit($form, &$form_state) { */ function file_managed_file_save_upload($element) { $upload_name = implode('_', $element['#parents']); - if (empty($_FILES['files']['name'][$upload_name])) { + $files = Drupal::request()->files->all(); + if (empty($files['files']['name'][$upload_name])) { return FALSE; } @@ -1190,8 +1191,8 @@ function file_managed_file_save_upload($element) { } // Save attached files to the database. - $files_uploaded = $element['#multiple'] && count(array_filter($_FILES['files']['name'][$upload_name])) > 0; - $files_uploaded |= !$element['#multiple'] && !empty($_FILES['files']['name'][$upload_name]); + $files_uploaded = $element['#multiple'] && count(array_filter($files['files']['name'][$upload_name])) > 0; + $files_uploaded |= !$element['#multiple'] && !empty($files['files']['name'][$upload_name]); if ($files_uploaded) { if (!$files = file_save_upload($upload_name, $element['#upload_validators'], $destination)) { watchdog('file', 'The file upload failed. %upload', array('%upload' => $upload_name));