#19644 [WFx->]: php.net is still using global vars!

From: Date: Sat, 28 Sep 2002 17:23:04 +0000
Subject: #19644 [WFx->]: php.net is still using global vars!
References: 1  Groups: php.mirrors 
Request: Send a blank email to php-mirrors+get-12826@lists.php.net to get a copy of this message
ID: 19644 Updated by: rasmus@php.net Reported By: zyprexia@php.net Status: Won't fix Bug Type: Website problem Operating System: Linux 2.4.19 (Slackware 8.1) PHP Version: 4.2.3 New Comment: It is actually a pretty good example of PHP code. All internal variables are initialized which means that turning register_globals off in our case does nothing except make the code less readable. Turning register_globals off is only something you really need to do when you don't trust the code you are running. Previous Comments: ------------------------------------------------------------------------ [2002-09-28 12:13:53] zyprexia@php.net This answer won't do! This is a very easy bug to fix and it won't take much time.. Step 1: Find out what global vars are changed into $_SERVER (Just writing down all the $_SERVER vars you can find in phpinfo()) Step 2: Do for each variable that is written down a global replace (e.g. s/$SERVER_NAME/$_SERVER["SERVER_NAME"]/g) on each file in the tree. Step 3: Test changed with in php.ini the flag register_globals=off Step 4: If step 3 was succesful, commit changes, done! We've already had to convert 13 websites that is under maintainance of the company i work for. We did it in less than an hour. (Except for testing and commiting) Right now the PHP site isn't a good example for other developers.. And i can clear a few hours to fix this, but i don't have the the cvstree (my cvs username is zyprexia). For now we wrote a simple script that is patching the php.net website, so we can turn global vars off.. ------------------------------------------------------------------------ [2002-09-28 04:47:38] goba@php.net We have info at http://php.net/mirroring about what settings PHP.net mirror required to use to operate. We have register_globals on there. Nearly every piece of code uses global vars on the site, and noone with enough time to rewrite it all... ------------------------------------------------------------------------ [2002-09-27 19:17:04] zyprexia@php.net M$ Mouse has his own mind with dropdowns ;-( This time is selected the right option. Tip: Disable your scrollwheel under windows, it changes your option within the dropdown in stead of going down the page.. ------------------------------------------------------------------------ [2002-09-27 19:12:11] zyprexia@php.net Hi, I'm the maintainer of the nl2.php.net mirror. After upgrading from php 4.1.2 to php 4.2.3, the search capabilities of the php.net site were down to zero! Reason, like announced by the php dev team, global vars are off. so the variable $SERVER_NAME (in /search.php) doesn't exist within 4.2.3. This has to be changed into _SERVER["SERVER_NAME"], Same with $REQUEST_URI. I'm even still a bit suprised that did wasn't fix on the main PHP site. I don't have cvs access to the phpweb tree, so i can't change it. For the moment i have enabled global vars to enable the search (quick links) capabilities of the php.net site ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=19644&edit=1

« previous php.mirrors (#12826) next »