Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 293752

Change notice: Replace all remaining superglobals ($_GET, $_POST, etc.) with Symfony Request object

$
0
0

In order to depend on using the Request object to determine caching, we need to ensure that everything uses it, rather than raw PHP variables for $_SERVER, $_REQUEST, $_GET, $_POST.

Conversion Guide

Remaining tasks: One last patch to remove all last $_GET, $_POST, $_COOKIE, $_REQUEST references. (Ignore $_SESSION for now, as it's being addressed elsewhere.)

Here are the methods on the Request object that map to PHP variables.

  • $request->query The GET parameters
  • $request->request The POST parameters
  • $request->attributes The request attributes (parameters parsed from the PATH_INFO, ...)
  • $request->cookies The COOKIE parameters
  • $request->files The FILES parameters
  • $request->server The SERVER parameters

See the Symfony documentation for an overview or a full list of convenience methods

To get the request object:

  1. If it is a route controller method, you can add a Request parameter as the last param in the method signature, and it will magically be passed in
  2. If you are in a new PSR-0, namespaced class, use \Drupal::request() (with a leading backslash)
  3. If you are in old-skool functional land (e.g. includes) use Drupal::request() (without a leading backslash)

Sub-issues

NameIssue
Includes#1998696: Use Symfony Request for core includesAssigned to: kmcculloch
Core classes#1998700: Use Symfony Request for core classesAssigned to: mhagedon
Action module#1998704: Use Symfony Request for action moduleAssigned to: chertzog
Aggregator module#1999338: Use Symfony Request for aggregator moduleAssigned to: chertzog
Block module#1998708: Use Symfony Request for block module
Comment module#1999340: Use Symfony Request for comment moduleAssigned to: chertzog
Edit module#1999344: Use Symfony Request for edit module
Field UI module#1999346: Use Symfony Request for fieldui moduleAssigned to: atchijov
File module#1999370: Use Symfony Request for file moduleAssigned to: chertzog
Filter module#1999376: Use Symfony Request for filter moduleAssigned to: chertzog
Image module#1999384: Use Symfony Request for image moduleAssigned to: arknoll
Language module#1999388: Use Symfony Request for language module
Locale module#1999394: Use Symfony Request for locale module
Menu module#1999398: Use Symfony Request for menu moduleAssigned to: chertzog
Node module#1999404: Use Symfony Request for node module
Overlay module#1999408: Use Symfony Request for overlay moduleAssigned to: atchijov
Path module#1999424: Use Symfony Request for path module
Search module#1999426: Use Symfony Request for search module
Shortcut module#1999428: Use Symfony Request for shortcut moduleAssigned to: chrishks
Simpletest module#1999430: Use Symfony Request for simpletest moduleAssigned to: chertzog
System module#1999434: Use Symfony Request for system module
Taxonomy module#1999436: Use Symfony Request for taxonomy moduleAssigned to: sidharthap
Toolbar module#1999442: Use Symfony Request for toolbar moduleAssigned to: chertzog
Translation module#1999444: Use Symfony Request for translation moduleAssigned to: chertzog
User module#1999448: Use Symfony Request for user moduleAssigned to: chertzog
Views module#1999450: Use Symfony Request for views module

..


Viewing all articles
Browse latest Browse all 293752

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>