Posted by Tony-Mac on April 27, 2012 at 11:24pm
I am suddenly having problems with editors. I had wysiwyg editor installed. Used CKEditor and TinyMce and disabled both trying to get to root of prob. Used all filters on code. Full HTML, Filtered HTML and even display suite code. Tried all variations of above and even straight text.
But since this morning any piece of code I touch in a block adds a backslash in front of a single or double quote.
I.E
Membership?
Text stuff.
or even in the text itself when there is a single quote.
Credit Union \\'SWITCH\\' campaign produces positive results.
Has anyone had this problem?
Would appreciate any help greatly.
Thanks


Comments
oops
OOPs of course my html code example of the error was rendered.
Subbing '=' for '<'.
=div class=\"sidebarBlock\">
=div class=\"sidebarcontent\">
=h3>
Membership?=/h3>
=span>Text stuff.=/span>=/div>
=div class=\"ReadMoreBlueBelow\">
=span>=img alt=\"alt tag\" src=\"images/sidebar/arrow.jpg\" />=a href=\"membership\">More=/a>=/span>=/div>
=/div>
I think it's a filter
I think it's a filter configuration issue. Take one text format and try disabling the filters until the backslashes stop appearing.
Quotes escaped with slash breaking links
The same thing just started happening to me on all my sites. All quotes are being escaped with a slash. It's not a filter and I've tried using plain text with no editor. It happens when editing or submitting a new story. Perhaps a change in php or mysql on the server side?
Is the following page
Is the following page helpful?
http://drupal.org/node/989004
I made the change to
I made the change to .htaccess but no change.
I just learned about this in my In my Basic PHP class
We are writing php code using AMP stacks locally. We I first tried to do an INSERT to the MySQL database for user input, it would error out because MySQL uses single quotes as well to define the start and end of the string values.
Turning on the magic_quotes_gpc setting in PHP places a backslash character in front of any single or double quote character in data retrieved from a form. The backslash character tells MySQL to treat the quote as part of the data and not part of the string delineator. The backslash isn't added to the data, it's silently stripped away when the data is stored in the table.
WAMP has this off by default as will PHP 5.4 according to the documentation. I'm told that PHP coders don't like relying on the magic_quotes_gpc setting, and instead prefer to handle the data themselves.
if (!get_magic_quotes_gpc())
{
$title = addslashes($title);
$author = addslashes($author);
}
Trouble is, you cannot use BOTH. They you get all kinds of double slashes, etc. and other crazy stuff going on. Combine that with WYSIWYG and it is a backslash tornado!
I don't know what the WYSIWYG editors or even Drupal does about this, but try turning off magic_quotes_gpc if you have access tothe PHP.ini or can override with .phprc file.
James Sinkiewicz
Drupal Site Builder and Generalist
http://MyDrupalJourney.com
made the change to php.ini
Turned magic quotes off as you suggested James. But am still getting the weirdness. Another thing is that when I save the block a popup window asks me "This page is asking you to confirm that you want to leave - data you have entered may not be saved" with the choice of stay on page or leave page.
Weirdness squared. I am going to bed. Thanks for your help. (famous name you carry James.) Thanks Ron.
Bluehost?
Dinghyman are you on Bluehost?
James where are you taking that course?
Host PHP Security Update?
I'm still holding on to this being a magic_quotes_gpc issue. There was a security update for PHP about 6 weeks ago that "fixed" this:
"It was discovered that PHP allowed the magic_quotes_gpc setting to
be disabled remotely. This could allow a remote attacker to bypass
restrictions that could prevent an SQL injection. (CVE-2012-0831)"
If your host applied the "fix", PHP will ignore your settings and your phpinfo() will report magic_quotes_gpc as off, but it is not. Then Drupal does it's "magic" in commin.inc and thinks magic_quotes_gpc is off and you really get some crazy stuff!
The recommended "fix-fix" is to comment out the directive in the .htaccess that your host provides that says "php_value magic_quotes_gpc 0"
Read more at http://drupal.org/node/143799
***Taking Begining PHP course Online from CalState San Marcos Extensions:
http://www.ed2go.com/csusmel/
James Sinkiewicz
Drupal Site Builder and Generalist
http://MyDrupalJourney.com
.htaccess
I guess I don't have access to that file. The one .htaccess I can access is at my root \public_html and it doesn't have anything except these lines:
Use PHP5 Single php.ini as default
AddHandler application/x-httpd-php5s .php
Have you actually fixed the problem with this solution?
Thanks
Backslashes
This seems to be a problem with the newest version of CKeditor, all was working well and suddenly this began to happen and the only change being the update to CKeditor.
Even switching from preview to code adds in even more slashes.
I switched to php input as well and the same problem occurs.
I disabled magic quotes in my php.ini and that had no affect.
Bluehost and backslashes
This is a recent Hostmonster and Bluehost server issue
In php.ini change this
; Magic quotes for incoming GET/POST/Cookie data.
magic_quotes_gpc = Off
Backslashes and Bluehost
http://drupal.org/node/1549800
; Magic quotes for incoming GET/POST/Cookie data.
magic_quotes_gpc = Off
Bluehost?
Thanks but it hasn't worked for me even though I have php 5.2 enabled with single php.ini in \public_html. And I inserted that line into the ini file.
As mentioned I don't seem to be able to save the block. I mentioned the error message in firefox. The wording in Chrome is:
The changes you made will be lost when you leave this page. Are you sure you want to leave this page?
[with choices] Leave this page? Stay on this page?
Tony
Bkuehost
Of course since I can't save the block I really don't know 100% if the php.ini magic quotes solution would work.
quotes and backslashes
This same problem started for me yesterday April 27, 2012.
I'm on Hostmonster (mentioned above) so I think it's a Hostmonster problem.
I had not updated drupal or ckeditor for months.
So I updated both and nothing changed. I haven't found php.ini yet.
Magic Quotes
The solution mentioned above with php.ini finally worked for me.
No more backslashes.
My version of php had php.ini in the public_html folder.
Fixed and a note from Hostmonster
anntosh -- thanks much.
Summary: I had no php.ini. Went to c-panel, then "php config", then checked "PHP 5.2 (Single php.ini)", then "save changes". This created a php.ini in public_html. Then I set
magic_quotes_gpc = Off
[I changed On to Off]
That worked. It seems to me the problem came form the .htaccess file, which says:
php_flag magic_quotes_gpc off
Apparently this stopped working on April 27th. Because ".c" no longer meant ".2" ?????
Does this mean the other items in that if statement no longer work?
Here's the note from Hostmonster support:
Yes. you can find php.ini inside your public_html folder if you already have one or can install one from the php config tool from our cpanel. This problem actually seems to be specific to drupal because other platforms, Joomla, WP etc with similar functions aren't having the issue. As I'm not a developer for any of them, don't quote me on it, but the only people I've seen with the issue are using drupal so maybe the drupal forums might want to know so their devs can dig into it? The workaround they recommended should work, just remember to remove the ';' at the beginning of the line.
LOG entries
I looked in the log and find some entries I can not explain. I know I was sitting in a pub drinking beer with a buddy on the 26th from 6-9.
Yet the log says an anonymous user was running cron at 19:33. Is this something automatically run? Then the message about an image not being able to be generated sounds like one of the errors I had when I was trying to fix the backslash problem. I certainly wasn't awake at 2 in the morning. Not having much experience at all with the logging system in Drupal I really don't know how to explain. (yes my time zone settings are set to west coast.)
Here just a few of the entries.
cron 04/27/2012 - 09:48 Cron run completed. Anonymous (not verified)
image 04/27/2012 - 06:37 Unable to generate the derived image located at... Anonymous (not verified)
page not found 04/27/2012 - 02:20 node/7 Anonymous (not verified)
cron 04/27/2012 - 00:52 Cron run completed. Anonymous (not verified)
page not found 04/27/2012 - 00:52 node/11 Anonymous (not verified)
image 04/26/2012 - 23:15 Unable to generate the derived image located at... Anonymous (not verified)
cron 04/26/2012 - 19:33 Cron run completed. Anonymous (not verified)
page not found 04/26/2012 - 19:33 * Anonymous (not verified)
image 04/26/2012 - 19:10 Unable to generate the derived image located at... Anonymous (not verified)
cron 04/26/2012 - 15:51 Cron run completed. Anonymous (not verified)
Tony
cron
cron is usually set to run automatically. See Configuration / Cron on your drupal site.
yep, what @sstoft said for
yep, what @sstoft said for drupal7. Here's details: http://drupal.org/cron
also, google has a bunch of good info about magic quotes and drupal. (not a very good practice for your host to have "on" as default)
--
mike stewart { twitter: @MediaDoneRight | IRC nick: mike stewart }
Answer from Bluehost
"Some versions of Drupal have begun to display this problem with internal character escaping functionality. I suggest you contact their support, community forums or documentation if you wish a final answer as to the cause. Fixing the issue is very simple, you have two options stop the escape characters from being inserted:
Change to PHP 5.3 and update your Drupal installation to the most recent version. This can be done in the PHP Config section of the cPanel. Simply click on the radio button to the left of PHP 5.3 or PHP 5.3 Single (depending on which php.ini behavior you prefer) and then save the changes.
You may also disable magic_quotes_gpc in the php.ini. This is done by finding the php.ini that applies to your Drupal installation in the File Manager, and Editing it. Once inside, search (the ctrl+f find function is recommended) for the line magic_quotes_gpc=On and set this variable to magic_quotes_gpc=Off
Note, the magic_quotes_gpc line may exist more than once, if so, duplicates should be removed."
I'd suggest option 1 AND
I'd suggest option 1 AND option 2 (although option1 might cause a problem for D6 with SOME contributed modules). make backups. test.
Also, to clarify, it's not Drupal core. (IOW, its NOT Drupal). This is a symptom of certain contributed modules (and/or 3rd party libraries) that would cause this problem.
--
mike stewart { twitter: @MediaDoneRight | IRC nick: mike stewart }