Is using Super Global obsolete and insecure?

Asked

Viewed 37 times

1

I wonder if Using Super Global is obsolete and unsafe in PHP, and why.

For now we have the filter_input and I was left with that doubt.

1 answer

3


No, use superglobal is not obsolete or unsafe. What is obsolete and unsafe is linking to directive register_globals, that creates global variables based on superglobal variables. For example, $_POST['bla'] also exists as $bla.

Now, the data that exists in these variables are often (1) sensitive - it may be better to avoid storing - or (2) malicious - and then enter the filter_input, inter alia, to ensure that the input data is secure. What you have in the superglobals are the "pure" input data, it’s up to your application to treat them safely.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.