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

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
get things moved over.


>I've been using PHP 4.0.1 for ages now, and have decided to upgrade one
>my machines to 4.2.1 and get used to working under the new security
>I understand that older scripts are fully compatible with 4.1.0+, or
>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
>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
>write code using the new arrays, but that will run under older versions
>PHP. Would including something like this at the top of a script work:
>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).
>Michael Hall     [EMAIL PROTECTED]

Kurth Bemis - Network/Systems Administrator,

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

PGP key available -

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to