note 11873 added to language.variables.external.php
| From: | yasuo_ohgaki at hotmail dot com | Date: | Sun, 11 Mar 2001 09:02:26 +0000 |
| Subject: | note 11873 added to language.variables.external.php | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-12263@lists.php.net to get a copy of this message | ||
FYI.
PHP programmers are better to use $HTTP_*_VARS for several reasons.
1) Readability: With $HTTP_*_VARS, code readers does not have to check where values comes from. With
$HTTP_*_VARS, code maintenance can be much easier and programmer will spend less time for debugging
code.
2) Portability: If global var register order has been changed (May differ server to server), code
may not be portable. (Insecure also)
With PHP4, track vars are always enabled, so programmer can be sure there are $HTTP_*_VARS for
PHP4.
3) Security: Without $HTTP_*_VARS, sensitive variables may be over written by intruders. Or
sensitive variables may be over written due to changes in global var registration order.
4) Performance: If "register globals" is disabled, PHP does not have to make a copy for
global var. Programmer does not have to check to make sure variables are over written
unintentionally.
You could have these benefits by using $HTTP_*_VARS. Without $HTTP_*_VARS, programmers are loosening
those advantages in return of saving number of typing keys. It just does not worth it. IMHO.
http://www.php.net/manual/en/language.variables.external.php