Assigning it to another variable will serve you well when you decide to implement another method of input (json-encoded posts, xml-rpc, soap, etc.). Making sure you get what you need from the $_POST
array at the start early on and working with those values later will make it easier to reuse the code with those other inputs: the only thing that needs to change is the instantiation of those inputs.
Also, often you want to change a value somewhat (default trim()
-ing, etc.), which is better done on a local variable then an item in a $_POST
array. Certainly on bigger projects with dozens of coders it is in my opinion a good practice to always keep the $_POST
array as received, and not fiddle in it directly infuriating a hopelessly debugging coworker...
The risks and errors do not change: it is still user-input which you should never trust, and always assume the worst case scenario of. Standard SQL-injection, XSS, and other attacks are not prevented with the practise alone.