Is it safe to unset PHP super-globals if this behavior is documented?
Posted
by
Stephen
on Stack Overflow
See other posts from Stack Overflow
or by Stephen
Published on 2011-01-18T02:48:09Z
Indexed on
2011/01/18
2:53 UTC
Read the original article
Hit count: 191
I'm building a PHP framework, and in it I have a request object that parses the url as well as the $_GET
, $_POST
and $_FILE
superglobals.
I want to encourage safe web habits, so I'm protecting the data against SQL injection, etc.
In order to ensure users of this framework are accessing the safe, clean data through the request object, I plan to use unset($_GET, $_POST, $_REQUEST);
after parsing those variables.
I will document this in the method comments, and explain in the framework documentation that this is happening.
My question is: Would this be desirable behavior? What are the potential pitfalls that I have not foreseen?
© Stack Overflow or respective owner