Commit 66a1e0b3 authored by alexpott's avatar alexpott

Issue #1998700 by kim.pepper, mhagedon: Use Symfony Request for core classes.

parent cc249ad3
......@@ -87,8 +87,8 @@ public function on403Html(FlattenException $exception, Request $request) {
$path = $this->container->get('path.alias_manager')->getSystemPath(\Drupal::config('system.site')->get('page.403'));
if ($path && $path != $system_path) {
// Keep old path for reference, and to allow forms to redirect to it.
if (!isset($_GET['destination'])) {
$_GET['destination'] = $system_path;
if (!$request->query->has('destination')) {
$request->query->set('destination', $system_path);
}
$subrequest = Request::create('/' . $path, 'get', array('destination' => $system_path), $request->cookies->all(), array(), $request->server->all());
......@@ -154,8 +154,8 @@ public function on404Html(FlattenException $exception, Request $request) {
$system_path = $request->attributes->get('_system_path');
// Keep old path for reference, and to allow forms to redirect to it.
if (!isset($_GET['destination'])) {
$_GET['destination'] = $system_path;
if (!$request->query->has('destination')) {
$request->query->set('destination', $system_path);
}
$path = $this->container->get('path.alias_manager')->getSystemPath(\Drupal::config('system.site')->get('page.404'));
......
......@@ -71,10 +71,12 @@ public function mail(array $message) {
// but some MTAs incorrectly replace LF with CRLF. See #234403.
$mail_headers = join("\n", $mimeheaders);
$request = \Drupal::request();
// We suppress warnings and notices from mail() because of issues on some
// hosts. The return value of this method will still indicate whether mail
// was sent successfully.
if (!isset($_SERVER['WINDIR']) && strpos($_SERVER['SERVER_SOFTWARE'], 'Win32') === FALSE) {
if (!$request->server->has('WINDIR') && strpos($request->server->get('SERVER_SOFTWARE'), 'Win32') === FALSE) {
if (isset($message['Return-Path']) && !ini_get('safe_mode')) {
// On most non-Windows systems, the "-f" option to the sendmail command
// is used to set the Return-Path. There is no space between -f and
......
......@@ -18,8 +18,9 @@ class SchemaCache extends CacheArray {
* Constructs a SchemaCache object.
*/
public function __construct() {
$request = \Drupal::request();
// Cache by request method.
parent::__construct('schema:runtime:' . ($_SERVER['REQUEST_METHOD'] == 'GET'), 'cache', array('schema' => TRUE));
parent::__construct('schema:runtime:' . ($request->isMethod('GET')), 'cache', array('schema' => TRUE));
}
/**
......
......@@ -46,10 +46,12 @@ class ThemeRegistry extends CacheArray {
* Whether all modules have already been loaded.
*/
function __construct($cid, $bin, $tags, $modules_loaded = FALSE) {
$this->cid = $cid;
$this->bin = $bin;
$this->tags = $tags;
$this->persistable = $modules_loaded && $_SERVER['REQUEST_METHOD'] == 'GET';
$request = \Drupal::request();
$this->persistable = $modules_loaded && $request->isMethod('GET');
if ($this->persistable && $cached = cache($this->bin)->get($this->cid)) {
$data = $cached->data;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment