RE: [PHP] backwards compat for newly developed scripts ($_GET / $HTTP_GET_VARS)
-Original Message- From: Paul Nicholson [mailto:[EMAIL PROTECTED]] Sent: 02 October 2002 02:11 Hey gang, I've been wondering about developing scripts that the end-user might run on php 4.1.0. I've heard allot of ways except for one that I recently thought of. How about using: - if(!isset($_GET)) { global $HTTP_GET_VARS; $_GET = $HTTP_GET_VARS; } - ? That allows you to use $_GET as if you were using the new versions and it only requires one lineand doesn't depend on the new versions to have $HTTP_*_VARS. It also works for the other vars(POST, SESSION, etc). I think this is going the wrong way about it -- the $HTTP_*_VARS arrays may be deprecated, but the PHP developers have confirmed that they are not going to disappear any time soon, so for code that has to work regardless of register_globals setting and existence or not of superglobals, I'd stick with those. (And, as already pointed out, the $_* arrays you create in this way are *not* superglobals, and so would need to be globalled in every function which references them, just like the $HTTP_*_VARS arrays -- so the only saving is maybe a few characters less to type, but with the addition of much potential for confusion.) Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] backwards compat for newly developed scripts ($_GET / $HTTP_GET_VARS)
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 yeah, at the top of each functionwhere you would normally put global $HTTP_GET_VARS; The created $_GET is not a superglobal so its scope is only in the function its defined in or if you define it in the global namespace you'd have to global $_GET; inside of your function I'm sure that'll conflict with the superglobals on newer versions. On Wednesday 02 October 2002 12:13 am, Sascha Cunz wrote: At the top of each _function_? Urgs. Sounds like a hell of a lot of work. Would be enough at the beginning of the script - or even better, creating a dummy include for that or it might even be posibile to run it via an .htaccess (how is this option named php_prepend or such?). ... If they can't update the PHP Version they should update the ISP :-) Well, 4.0.6 might be a famous release (as you can find this very often), but it's about 1 year old now... If ISPs don't updated, they make their own machines vulnerable - the only conclusion (to make them learn their lesson) can be, that customers keep on running away, ain't it? Thats if they notice the one or two clients that leave over this issue. :| - -- ~Paul Nicholson Design Specialist @ WebPower Design The webthe way you want it! [EMAIL PROTECTED] It said uses Windows 98 or better, so I loaded Linux! Registered Linux User #183202 using Register Linux System # 81891 -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE9muqkDyXNIUN3+UQRAiHUAJ4mxVd+makwIpmvsgIYauKCPl+mhwCeMrFA z4cX5Z3+ib/hirVLc5cSHbA= =Se8t -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] backwards compat for newly developed scripts ($_GET / $HTTP_GET_VARS)
Hey gang, I've been wondering about developing scripts that the end-user might run on php 4.1.0. I've heard allot of ways except for one that I recently thought of. How about using: - if(!isset($_GET)) { global $HTTP_GET_VARS; $_GET = $HTTP_GET_VARS; } - ? That allows you to use $_GET as if you were using the new versions and it only requires one lineand doesn't depend on the new versions to have $HTTP_*_VARS. It also works for the other vars(POST, SESSION, etc). If any script shall be executeable on such an old PHP release, this method sounds really good. But, for security reasons i would prefer to ship this in an extra script, which the user has explicitly to include (Maybe just paranoia)... Hmm, anyway it would be better to force those old versions to be updated - since 1) there was a lot of security changes/updates and other bug fixes 2) new functions have been developed in more recent versions. i.e. executing stored procedures on MSSQL. I think, this will force people much more to update. Wouldn't it be better to force them now, than provide backward compatibility for _new_ scripts? Sascha -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] backwards compat for newly developed scripts ($_GET / $HTTP_GET_VARS)
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hey, [snip] If any script shall be executeable on such an old PHP release, this method sounds really good. But, for security reasons i would prefer to ship this in an extra script, which the user has explicitly to include (Maybe just paranoia)...[/snip] ummyou'd have to include that line at the top of every function that uses get(or any of the other) vars(scoping reasons) or somehow pass it via a reference to the function. I've always added the line at the top. [snip] Hmm, anyway it would be better to force those old versions to be updated - since 1) there was a lot of security changes/updates and other bug fixes 2) new functions have been developed in more recent versions. i.e. executing stored procedures on MSSQL. I think, this will force people much more to update. Wouldn't it be better to force them now, than provide backward compatibility for _new_ scripts?[/snip] Thats if the user has the option to upgrade - some system admin don't like to do their job...I know of quite a few isps still running 4.0.6:( ~Paul - -- ~Paul Nicholson Design Specialist @ WebPower Design The webthe way you want it! [EMAIL PROTECTED] It said uses Windows 98 or better, so I loaded Linux! Registered Linux User #183202 using Register Linux System # 81891 -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE9mmxgDyXNIUN3+UQRAuZBAJ0Y2xekGSnMFI2v+zvMww0LblchdQCeOkWv 4alNcCyFkohhLPiUYjKOI5E= =89QY -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] backwards compat for newly developed scripts ($_GET / $HTTP_GET_VARS)
ummyou'd have to include that line at the top of every function that uses get(or any of the other) vars(scoping reasons) or somehow pass it via a reference to the function. I've always added the line at the top. At the top of each _function_? Urgs. Sounds like a hell of a lot of work. Would be enough at the beginning of the script - or even better, creating a dummy include for that or it might even be posibile to run it via an .htaccess (how is this option named php_prepend or such?). ... Thats if the user has the option to upgrade - some system admin don't like to do their job...I know of quite a few isps still running 4.0.6:( If they can't update the PHP Version they should update the ISP :-) Well, 4.0.6 might be a famous release (as you can find this very often), but it's about 1 year old now... If ISPs don't updated, they make their own machines vulnerable - the only conclusion (to make them learn their lesson) can be, that customers keep on running away, ain't it? Sascha -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php