The only problem I see with any of these options is that the new arrays
are "superglobals" (not my term) and do not require the use of the
"global" command.  For instance:


function myfunc() {
  global $HTTP_POST_VARS;

  $somevar = $HTTP_POST_VARS["somevar"];
  ...
}

can now be written as:

function myfunc() {

  $somevar = $_POST["somevar"];
}


Sure you can extract the old ($HTTP_) arrays into the new, but you still
don't get the same functionality.  (Yes, you could put a 'global
$_POST;' in the new way, but that defeats the purpose of having the new
"superglobals")


Jaime Bozza

-----Original Message-----
From: Kurth Bemis (List Monkey) [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, May 30, 2002 9:59 AM
To: Michael Hall
Cc: PHP List
Subject: Re: [PHP] Post 4.1.0 PHP


At 11:35 PM 5/30/2002 +0930, Michael Hall wrote:

When I asked I got this response.

$types_to_register = array('GET','POST','COOKIE','SESSION','SERVER');
   foreach ($types_to_register as $type) {
     $arr = @${'HTTP_' . $type . '_VARS'};
     if (@count($arr) > 0) {
       extract($arr, EXTR_OVERWRITE);
     }
   }

put that at the of of your scripts and everything will work ok untill
you 
get things moved over.

~kurth


>I've been using PHP 4.0.1 for ages now, and have decided to upgrade one
of
>my machines to 4.2.1 and get used to working under the new security
>arrangements.
>
>I understand that older scripts are fully compatible with 4.1.0+, or
can
>be made
>so with minimal fuss. I am assuming that scripts written using the new
>$_GET and $_POST (etc) arrays simply won't run under pre-4.1.0 versions
of
>PHP.
>
>So, where does this leave us with regard to ISPs that still run older
>versions of PHP (so that users' scripts won't break)? Is there some way
to
>write code using the new arrays, but that will run under older versions
of
>PHP. Would including something like this at the top of a script work:
>
>$_POST = $HTTP_POST_VARS;
>
>while inside the code reference is made only to $_POST ?
>
>Sorry if this has been covered repeatedly, I've only just rejoined the
>list after a break from the relentless volume (of great, useful info).
>
>TIA
>--------------------------------
>Michael Hall     [EMAIL PROTECTED]
>--------------------------------
>

Kurth Bemis - Network/Systems Administrator, USAExpress.net/Ozone
Computer

"Jedi business, Go back to your drinks" - Anakin Skywalker, AOTC

[EMAIL PROTECTED] | http://kurth.hardcrypto.com
PGP key available - http://kurth.hardcrypto.com/pgp




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to