Jump to content

Magic Quotes disabled but still somehow working


pigmonkey

Recommended Posts

I realized today that Magic Quotes were enabled (magic_quotes_gpc=On in phpinfo();), so I needed to turn them off. I added the following to my .htaccess file in the root folder:

php_value magic_quotes 0
php_flag magic_quotes off
php_value magic_quotes_gpc 0
php_flag magic_quotes_gpc off

 

Yes, probably complete overkill, but oh well. Now, magic_quotes_gpc=Off in phpinfo(), and get_magic_quotes_gpc() returns false like I would expect it to... except things are still getting slashes added to them. Here's my test file:

 

<?php
if(get_magic_quotes_gpc())
echo "Magic quotes are enabled<br>";
else
echo "Magic quotes are disabled<br>"; 
echo nl2br(print_r($_POST, true));
?>
<form method="POST">
<input type="text" name="one">
<input type="text" name="two">
<input type="submit" value="Submit">
</form>

 

And with the input:

it's really getting annoying

"what's going on"

 

I get the output:

Magic quotes are disabled

Array

(

[one] => it\'s really getting annoying

[two] => \"what\'s going on\"

)

 

So, despite the fact that magic quotes seem to be disabled, things are still getting random slashes. I could just strip them, but until I find the underlying cause, I have no control or idea if it will stop doing this. I'm completely out of ideas, and numerous attempts at searching has led me to nothing. What could be a possible cause here?

Link to comment
Share on other sites

While I don't have access to php.ini, I know that .htaccess is certainly doing something. If I comment out the lines that I posted above, the php script as well as phpinfo() tells me that magic quotes is enabled. Though, I will admit I don't know what "AllowOverride All" does or if it's necessary. I tried putting that in my .htaccess file, but got a 500 error.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.