diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc index b472313..90c9aa2 100644 --- a/core/includes/bootstrap.inc +++ b/core/includes/bootstrap.inc @@ -469,16 +469,16 @@ function config_get_config_directory($type = CONFIG_ACTIVE_DIRECTORY) { * @see \Symfony\Component\HttpFoundation\Request::getClientIP() */ function drupal_override_server_variables($variables = array()) { - $server = \Drupal::request()->server; - $server_vars = $server->all(); + $request = \Drupal::request(); + $server_vars = $request->server->all(); // Allow the provided URL to override any existing values in $_SERVER. if (isset($variables['url'])) { $url = parse_url($variables['url']); if (isset($url['host'])) { - $server_vars['HTTP_HOST'] = $url['host']; + $server_vars['HTTP_HOST'] = $request->getHttpHost(); } if (isset($url['path'])) { - $server_vars['SCRIPT_NAME'] = $url['path']; + $server_vars['SCRIPT_NAME'] = $request->getScriptName(); } unset($variables['url']); } @@ -495,7 +495,7 @@ function drupal_override_server_variables($variables = array()) { 'HTTP_USER_AGENT' => NULL, ); // Replace elements of the $_SERVER array, as appropriate. - $server->replace($variables + $server_vars + $defaults); + $request->server->replace($variables + $server_vars + $defaults); } /** diff --git a/core/includes/common.inc b/core/includes/common.inc index 81d054b..153763a 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -523,7 +523,7 @@ function drupal_get_destination() { * $options['query'] and the fragment into $options['fragment']. * * @param $url - * The URL string to parse, i.e \Drupal::request()->query->get('destination'). + * The URL string to parse. * * @return * An associative array containing the keys: diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc index 6f4b859..c923c8d 100644 --- a/core/includes/install.core.inc +++ b/core/includes/install.core.inc @@ -256,9 +256,9 @@ function install_begin_request(&$install_state) { // A request object from the HTTPFoundation to tell us about the request. $request = Request::createFromGlobals(); - // Create a minimal container for t() and request to work. This container will - // be overriden but it needed for the very early installation process when - // database tasks run. + // Create a minimal container so that t() and $request will work. This + // container will be overriden but it's needed for the very early installation + // process when database tasks run. $container = new ContainerBuilder(); $container->set('request', $request); \Drupal::setContainer($container); diff --git a/core/lib/Drupal/Component/Utility/Url.php b/core/lib/Drupal/Component/Utility/Url.php index fa22667..4f61a92 100644 --- a/core/lib/Drupal/Component/Utility/Url.php +++ b/core/lib/Drupal/Component/Utility/Url.php @@ -119,13 +119,14 @@ public static function filterQueryParameters(array $query, array $exclude = arra * The returned array contains a 'path' that may be passed separately to url(). * For example: * @code - * $options = Url::parse(\Drupal::request->query->get('destination')); + * $options = Url::parse(\Drupal::request()->query->get('destination')); * $my_url = url($options['path'], $options); * $my_link = l('Example link', $options['path'], $options); * @endcode * * @param string $url - * The URL string to parse, i.e \Drupal::request->query->get('destination'). + * The URL string to parse, i.e. + * \Drupal::request()->query->get('destination'). * * @return * An associative array containing the keys: diff --git a/core/lib/Drupal/Core/Ajax/AjaxResponse.php b/core/lib/Drupal/Core/Ajax/AjaxResponse.php index 8cc728c..7bd7c38 100644 --- a/core/lib/Drupal/Core/Ajax/AjaxResponse.php +++ b/core/lib/Drupal/Core/Ajax/AjaxResponse.php @@ -76,10 +76,11 @@ protected function ajaxRender(Request $request) { // diffing logic using array_diff_key(). $ajax_page_state = $request->request->get('ajax_page_state'); foreach (array('css', 'js') as $type) { - // It is highly suspicious if $ajax_page_state[$type] is empty, - // since the base page ought to have at least one JS file and one CSS file - // loaded. It probably indicates an error, and rather than making the page - // reload all of the files, instead we return no new files. + // It is highly suspicious if + // $request->request->get("ajax_page_state[$type]") is empty, since the + // base page ought to have at least one JS file and one CSS file loaded. + // It probably indicates an error, and rather than making the page reload + // all of the files, instead we return no new files. if (empty($ajax_page_state[$type])) { $items[$type] = array(); } diff --git a/core/lib/Drupal/Core/Form/FormBuilderInterface.php b/core/lib/Drupal/Core/Form/FormBuilderInterface.php index 36a6220..c6657bd 100644 --- a/core/lib/Drupal/Core/Form/FormBuilderInterface.php +++ b/core/lib/Drupal/Core/Form/FormBuilderInterface.php @@ -155,7 +155,7 @@ public function getForm($form_arg); * should use the data in the 'values' array exclusively. The most common * use of this key is for multi-step forms that need to clear some of the * user input when setting 'rebuild'. The values correspond to - * \Drupal::Request()->request or \Drupal::Request()->query, depending on + * \Drupal::request()->request or \Drupal::request()->query, depending on * the 'method' chosen. * - always_process: If TRUE and the method is GET, a form_id is not * necessary. This should only be used on RESTful GET forms that do NOT diff --git a/core/modules/file/file.module b/core/modules/file/file.module index 1d467be..46f0558 100644 --- a/core/modules/file/file.module +++ b/core/modules/file/file.module @@ -791,33 +791,33 @@ function file_save_upload($form_field_name, $validators = array(), $destination } $files = array(); - foreach ($uploaded_files as $i => $file) { + foreach ($uploaded_files as $i => $file_info) { // Check for file upload errors and return FALSE for this file if a lower // level system error occurred. For a complete list of errors: // See http://php.net/manual/features.file-upload.errors.php. - switch ($file->getError()) { + switch ($file_info->getError()) { case UPLOAD_ERR_INI_SIZE: case UPLOAD_ERR_FORM_SIZE: - drupal_set_message(t('The file %file could not be saved because it exceeds %maxsize, the maximum allowed size for uploads.', array('%file' => $file->getName(), '%maxsize' => format_size(file_upload_max_size()))), 'error'); + drupal_set_message(t('The file %file could not be saved because it exceeds %maxsize, the maximum allowed size for uploads.', array('%file' => $file_info->getFilename(), '%maxsize' => format_size(file_upload_max_size()))), 'error'); $files[$i] = FALSE; continue; case UPLOAD_ERR_PARTIAL: case UPLOAD_ERR_NO_FILE: - drupal_set_message(t('The file %file could not be saved because the upload did not complete.', array('%file' => $file->getName())), 'error'); + drupal_set_message(t('The file %file could not be saved because the upload did not complete.', array('%file' => $file_info->getFilename())), 'error'); $files[$i] = FALSE; continue; case UPLOAD_ERR_OK: // Final check that this is a valid upload, if it isn't, use the // default error handler. - if (is_uploaded_file($uploaded_files['files']['tmp_name'][$form_field_name][$i])) { + if (is_uploaded_file($file_info->getRealPath())) { break; } // Unknown error default: - drupal_set_message(t('The file %file could not be saved. An unknown error has occurred.', array('%file' => $file->getName())), 'error'); + drupal_set_message(t('The file %file could not be saved. An unknown error has occurred.', array('%file' => $file_info->getFilename())), 'error'); $files[$i] = FALSE; continue; @@ -826,9 +826,9 @@ function file_save_upload($form_field_name, $validators = array(), $destination $values = array( 'uid' => $user->id(), 'status' => 0, - 'filename' => trim(drupal_basename($file->getName(), '.')), - 'uri' => $uploaded_files['files']['tmp_name'][$form_field_name][$i], - 'filesize' => $uploaded_files['files']['size'][$form_field_name][$i], + 'filename' => $file_info->getClientOriginalName(), + 'uri' => $file_info->getRealPath(), + 'filesize' => $file_info->getSize(), ); $values['filemime'] = file_get_mimetype($values['filename']); $file = entity_create('file', $values); @@ -931,7 +931,7 @@ function file_save_upload($form_field_name, $validators = array(), $destination // directory. This overcomes open_basedir restrictions for future file // operations. $file->uri = $file->destination; - if (!drupal_move_uploaded_file($uploaded_files['files']['tmp_name'][$form_field_name][$i], $file->getFileUri())) { + if (!drupal_move_uploaded_file($file_info->getRealPath(), $file->getFileUri())) { form_set_error($form_field_name, t('File upload error. Could not move uploaded file.')); watchdog('file', 'Upload error. Could not move uploaded file %file to destination %destination.', array('%file' => $file->filename, '%destination' => $file->uri)); $files[$i] = FALSE; diff --git a/core/modules/system/system.module b/core/modules/system/system.module index 702f460..fbe459e 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -2744,7 +2744,7 @@ function system_default_region($theme) { * * If the submit handler for a form that implements confirm_form() is invoked, * the user successfully confirmed the action. You should never directly - * inspect $_POST or \Drupal::request90->request to see if an action was + * inspect $_POST or \Drupal::request()->request to see if an action was * confirmed. * * Note - if the parameters $question, $description, $yes, or $no could contain