phpmagic-quotes-gpc

Why does my quoted text appear \"like this\"?


Possible Duplicate:
“slash before every quote” problem

I am passing messages between different parts of my php application using code that looks like this:

$msg='"'.$_REQUEST['site'].'" modified.';
header('Location: sites.php?msg='.$msg);
exit();

The code that picks it up on the other end look like this:

<?php if (isset($_GET['msg'])) {echo '<p><em>'.$_GET['msg'].'</em></p>';}?>

In my development environment, the output looks like this: "Some site" modified. In my production environment, the output looks like this: \"Some site\" modified.

This leads me to believe that it is a difference in the settings in the php.ini between the environments. I've searched until my eyeballs are blistered, but I can't find the difference. What gets passed in the url looks like this:

sites.php?msg="Some site" modified

If I put this code:

$msg=htmlspecialchars($msg);

between the variable assignment and header call above, the url looks like this:

sites.php?msg=&quot;Some site&quot; modified.

But no message is displayed in either environment. I also have a similar problem if $_REQUEST['site'] contains an ampersand.

Can anyone explain what is going on here, and how to fix it?


Solution

  • The config is called magic_quotes_gpc