magic quotes and register globals

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

even though register globals is disabled by default, i'm currious as to
how it and magic quotes interact.  consider the following code:

  // assuming $_GET['var']='"test"' and register globals enabled
  echo $var;

will the output be "test" or \"test\"?

Re: magic quotes and register globals

First of all, magic quotes and register globals have nothing to do with
each other.  If register globals was enabled in your example above, a
variable $var would automatically available.  If register globals is
disabled, it won't be available as $var, but rather as $_GET['var'] (or
$_POST['var'], etc.).

If you have magic_quotes_gpc enabled, your example will output \"test\"
regardless of the register globals setting.

Site Timeline