Drupal 7 – Backslashes being added to quotes on Blacknight Hosting

This is a very strange and annoying problem, when editing content on a Drupal 7 installation backslashes were being automatically put before quotes – a real pain especially when editing HTML!


This is a well known issue caused by a silly PHP5 module called ‘magic quotes’. Anyway on Blacknight I found that the only way to get rid of the problem was to make sure that magic quotes functionality was turned on in .htaccess – this would force Drupal to successfully work around the issue. The way to do this is to make sure the the following is included the .htaccess file:

  php_flag magic_quotes_gpc          on
  php_flag magic_quotes_sybase       on

This seems counter intuitive – surely we want to turn magic quotes off? however, including these lines in the file lets Drupal 7 know that the magic quotes functionality is turned on and then it successfully fixes the problem itself..