2

I wanted to confirm with the community and maybe get some clarity about D8 Documentation:

On the Core request handling system ported to Symfony2 framework page it states:

The PHP superglobals for $_GET, $_POST, and $_SERVER are deprecated and should not be used, ever.

However, I can't seem to locate this information on php.net. PHP setting register_globals is deprecated. Is this what they are refering to or did I miss something huge in recent news? No longer able to use $_GET in our custom modules for D8?

2
  • Use the RequestStack service. Commented Feb 27, 2019 at 20:23
  • Yes, because Drupal is a stack middleware, see stackphp.com Commented Feb 27, 2019 at 21:20

1 Answer 1

2

I'm pretty sure the advice stems from this issue: Replace almost all remaining superglobals ($_GET, $_POST, etc.) with Symfony Request object. The opening gambit from that post is:

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.

I don't the quoted comment is suggesting they're deprecated in PHP as such, just that using them in Drupal isn't going to be reliable.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.