Cannot re-assign auto-global variable %s
Description
It is not possible to use one of the superglobal variable names as argument of a method: such code hides the assignation that happens at call time, which will interfere with the $_POST variable being a global. Hence, such syntax is forbidden.
The error is not emitted when the same superglobal variables are used as variables, as it may be legit code.
This applies to all PHP superglobal, such as $_ENV, $GLOBALS, or $_POST. See the full list in annex.
Example
<?php
function foo($_POST) {
}
?>
Literal Examples
- Cannot re-assign auto-global variable $_POST
Alternatives
- Use a parameter anme that is not a superglobal or a special PHP variable.