Re: Deprecating "global" + $GLOBALS, making $_REQUEST, $_GET, $_POST read-only

From: Date: Thu, 09 Dec 2010 11:06:47 +0000
Subject: Re: Deprecating "global" + $GLOBALS, making $_REQUEST, $_GET, $_POST read-only
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to internals+get-50936@lists.php.net to get a copy of this message
Alain Williams wrote:
On Thu, Dec 09, 2010 at 11:53:08AM +0100, Andrey Hristov wrote:
Is copying the POST variables into another variables best practice (like a manual register_globals)? In the global scope of the application I think it's cleaner to work with $_POST to overwrite the values than copying the items into variables. Inside a function/method, I agree that it's best practice to pass $_POST as a parameter and then overwrite the values as you need.
$_POST is POST, incoming variables, everything else is a hack. If you expect that the variable might change then copy it, at least someone this will signal that the value might have been changed somewhere.
What is the real difference between operating on $_POST directly and some other copy of it ? Not everyone writes huge, complicated scripts written by many different people.
conceptual. If it is a copy it means something was changed, right? Andrey

« previous php.internals (#50936) next »