php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19644 php.net is still using global vars!
Submitted: 2002-09-27 19:12 UTC Modified: 2002-09-28 13:13 UTC
From: zyprexia@php.net Assigned:
Status: Wont fix Package: Website problem
PHP Version: 4.2.3 OS: Linux 2.4.19 (Slackware 8.1)
Private report: No CVE-ID: None
 [2002-09-27 19:12 UTC] 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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-09-27 19:17 UTC] 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-28 04:47 UTC] 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-28 12:13 UTC] 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 12:23 UTC] rasmus@php.net
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.
 [2002-09-28 13:13 UTC] goba@php.net
Your steps does not "fix" the website, we also have GET and POST values used from global vars. They cannot be found any way you proposed. BTW from functions the "global $varname" things should also be removed, etc. It's not that simple as it seems for the first time.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 14:01:32 2024 UTC