C
C
c7585422013-11-14 20:12:26
PHP
c758542, 2013-11-14 20:12:26

PHP access to superglobal arrays

Netbeans suddenly started giving warnings "Do not directly access the $_POST ($_GET, $_SERVER) superglobal". What is the threat and how do you get these variables?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
E
Eugene, 2013-11-14
@Agent_J

There were no such questions on the hub ...

It doesn't threaten anything. As a rule, the application uses a framework or libraries that provide safe access to superglobal arrays - they filter / screen / cast data to the desired type. If you do not use this, then access the incoming data yourself, but never trust it.

I think Netbeans started swearing not "suddenly", but after you changed something in the settings.

M
muspelheim, 2013-11-14
@muspelheim

It is also written there that it is better to use, I have already switched to these recommendations, nothing has essentially changed except for improved readability in the code.

they also added a lot of tips on Clean Code, and code formatting, for example, methods more than 10 lines are highlighted, and you can quickly format the code to a given template if you write in a team that adopts a style different from yours.

I
igordata, 2013-11-14
@igordata

What about the version?

O
OnYourLips, 2013-11-14
@OnYourLips

This is correct advice. An application usually has one global variable ($application) and does not need to be accessed directly.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question