From: Reini U. <ru...@x-...> - 2002-09-04 07:16:59
|
Joby Walker schrieb: > Reini Urban wrote: >>> I had in mind the comment in the php manual which says: >>> $_SERVER >>> >>> "Variables set by the web server or otherwise directly related to the >>> execution environment of the current script. Analogous to the old >>> $HTTP_SERVER_VARS array (which is still available, but deprecated)." >>> >>> [see >>> http://uk2.php.net/manual/en/language.variables.predefined.php#language.variables.superglobals >>> ] >> >> up to 4.2.2 they are still there. guess for 4.3 also (BTW: 4.3-rc2 is >> out), but for the upcoming 5.0 they might go away. >> no problem, they can easily be created from the superglobals. > > Do we want to make a policy on this? $HTTP_SERVER_VARS is deprecated, > and thus in the future may be dropped. On the other hand old (unsecure) > PHP installations will not support $_SERVER. We really should use one > or the other not both. > > Personally, I support using the $_SERVER, $_GET, etc family of > superglobals despite some possible breakage of old PHP installations, > because it is the preferred way, eventually we will probably have to > migrate to it anyway, and it is more elegant. I prefer the other way round. $GLOBALS['HTTP_SERVER_VARS'] will always work with simple workarounds in prepend.php. $_SERVER is a mess to maintain, because nobody will declare it global. > How many installations are on PHP < 4.1.0? If this breakage is an issue > we can if PHP version is < 4.1.0 set $_SERVER = $HTTP_SERVER_VARS, > $_COOKIE = $HTTP_COOKIE_VARS, etc. > > Or is the consensus to wait to convert until it is necesary? Keep our style and add: if (empty($HTTP_ENV_VARS)) { $HTTP_SERVER_VARS = &$_SERVER; $HTTP_GET_VARS = &$_GET; $HTTP_POST_VARS = &$_POST; $HTTP_COOKIE_VARS = &$_COOKIE; $HTTP_SESSION_VARS = &$_SESSION; $HTTP_ENV_VARS = &$_ENV; // $_FILES not needed globally for now, only once in Request. // We should also find some way to support the CGI version by // using ENV instead of SERVER automatically. } when they become depricated. I see a bigger problem with other apps which already converted to the new superglobals on "old" php 4.0.6 systems. They are still very common on ISP sites. I work for a large one. -- Reini Urban http://inode.at/ |