Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

The PHP 4.2.0 Update - You've done it, right?
Jul 26, 2002 @ 11:51:39

One of the major problems in the move from a version below PHP 4.2.0 to something above was the big change in "register_globals" that changed so many user's lives. There were people on both sides of the fence too - those that loved the idea because it made their scripts more secure and more "correct", and those that despised it and immediately found a way to turn it back to the "normal" setting that it was before.
Well, Zend.com has a piece this morning that talks about how you can make the shift with your own scripts, and what really needs to change so that they'll work 100% with the new features. Coding PHP with register_globals Off gives you several new things to watch out for and places your code will need the change (like input from a cookie, a form, from the URL/GET string, etc). It's not a bad overview for those out there that still haven't switched, and gives you a pretty good idea of what you'd need to change. And, of course, they provide the easy way out for those that are just too lazy, dont have the time, etc:

I can already hear the excuses: "I don't have enough time", or "The program is third party code and I do not want to learn and maintain it".
If you must hack your way around the register_globals Off default value, I would suggest reading up on the import_request_variables() function (http://www.php.net/manual/en/function.import-request-variables.php) or reviewing some of the reader posted comments related to the extract() function (http://www.php.net/manual/en/function.extract.php).

tagged:

Link:


Trending Topics: