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?

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.