Hi,

I'm running a drupal 7 installation (from local computer to server with backup/migrate module) and whenever I edit content, it adds a \ in front of the ' and " characters. When I look at the source, it's actually adding \ in front of " .

I have php version 5.2.9 and drupal 7.0. This happens both with and without ckeditor through the wysiwyg module.

Anyone know how to fix this?

Comments

Kirk’s picture

Sounds related to some sort of php filter. "\" is used to escape " in php. http://php.net/manual/en/language.types.string.php

TribalMan’s picture

Having the same problem. Any suggested fixes? I put some HTML in a block to make a button. Now there are backslashes before and after my elements. Sometimes it adds up to three before and after an element.

TribalMan’s picture

I fixed this by changing my php.ini file disallowing "magic-quotes"

techlizard’s picture

I was having the same problem.

Editing the php.ini and turning off magic_quotes fixed it for me too.

Suncho’s picture

Hi Cameron. I'm having the same problem when editing blocks. Backslashes are getting added before quotes. I started by creating the site on my local Apache server, then I exported the database from there and imported it onto my remote web server (also Apache). Everything worked fine until I went to edit a block. Editing pages doesn't exhibit the problem.

Did you ever figure out a solution?

Thanks!

mmrtnt’s picture

I encountered this the other day and in my case, it was the result of this config value in php.ini

magic_quotes_gpc = Off

My hosting provider (HostMonster, http://www.hostmonster.com) upgraded CentOS 5 to CentOS 6. Why this affected PHP, I'm not sure.

They were very helpful and all I needed to do was use their online tool to create a new php.ini file and make sure that the magic_quotes_gpc flag was "off".

Also, I found this workaround while looking for a fix that can be used in case your php.ini is not editable.

http://stackoverflow.com/questions/3117512/prevent-automatic-add-slashes...

Good luck.