pigmonkey Posted May 29, 2010 Share Posted May 29, 2010 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? Quote Link to comment https://forums.phpfreaks.com/topic/203264-magic-quotes-disabled-but-still-somehow-working/ Share on other sites More sharing options...
sKunKbad Posted May 29, 2010 Share Posted May 29, 2010 They don't call them magic for nothing... So, are you sure that you can use .htaccess files? For instance, AllowOverride All? Maybe try to turn them off in php.ini? Quote Link to comment https://forums.phpfreaks.com/topic/203264-magic-quotes-disabled-but-still-somehow-working/#findComment-1065105 Share on other sites More sharing options...
pigmonkey Posted May 29, 2010 Author Share Posted May 29, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/203264-magic-quotes-disabled-but-still-somehow-working/#findComment-1065176 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.