01 April 2009 ~ 0 Comments

PHP backslash issue

Recently I just encountered a problematic issue with PHP where every request, no matter it’s a GET or POST, all the values are somehow escaped with backslash (). Well, I guess this is due to my lack of knowledge on the existence of PHP default settings reside in apache.

After some research, I found that there is a setting in php that escapes all input from GET, POST and COOKIE (gpc). This setting name is called magic_quotes_gpc. Fortunately, this can easily be switched off in .htaccess by inserting the following line.

php_value magic_quotes_gpc 0

With this line, my painful problem is finally resolved. Personally, I think this switch should never have been switched on into PHP by default as it’s quite confusing for inexperience PHP developer. ;)

Leave a Reply

Spam protection by WP Captcha-Free