Hi I'm a newbie to Drupal.
I found a very wierd bug on one of my Drupal sites and NEED YOUR HELP~!!!

Here is the story.
When I create a new content and if there is a single quote (or apostrophe) in an article, my Drupal site shows it double.

For example, if I put < I'll be there. > then, it shows like < I''ll be there. >

If I go to edit mode back and click submit button again without making any changes, then it eventually shows < I''''ll be there. >

I've already spent my entire weekend to figure it out, but I don't have any clue at all.

To narrow it down what the problem is, I've disabled all the modules and functionalities and tested it. But it still has same problem. I have another drupal site working on under different web hosting, and it works fine.

Here is the website with the problem. http://fictive.arts.uci.edu You can create contents and see the problem without logging in to the site.

Is there anyone can really help? PLEASE~~!!!

thanks,

Comments

JirkaRybka’s picture

I tested what I can, and I confirm that it happens (I run FF 1.5/Linux Mandriva).
--- Happens also on Textarea's content, so it's not a text-filtering issue.
--- Happens at Preview, so it's not a node-submitting issue.
--- Happens the same with JavaScript disabled, and exists in all Web Developer Toolbar's infos I can think of, so no JavaScript issue.
--- So I must agree that Drupal (in your config, which I don't know exactly) generates that extra character somewhere in the process of Node-form validation/preview.

I don't have more ideas though - just the one to disable any non-core modules, which you say is already done.

cog.rusty’s picture

Check the input formats in your "/admin/settings/filters".
Go to your default selected input format and click "configure".
Check the enabled filters, to see if you suspect any of them to cause this effect.

bsjeon’s picture

As you said, I've checked out the input format configure and there is nothing weird as far as I see.
I tested creating new content after disabling all the filters in my default input format config., but still the same problem exists.
BTW, the website is running with only minimal core-modules. It's very weird!!!!!! I am almost crying. HELP~~~~

JirkaRybka’s picture

It's not anything about filters, otherwise the problem would occur only on node-view/preview, and not inside the editing textarea. Do you have anything special about your php-config, perhaps Regula Expressions? Just guessing, no clear idea from me.

cog.rusty’s picture

A mystery.

So, probably it is stored in the database changed and retrieved changed... It happens, for example in Quint's test string the characters & < and > appear in the editing text box as &amp; &lt; and &gt;, and they are also stored in the database changed.

Now what could cause a ' to become ''? Magic. Hmm... magic quotes? (http://php.net/magic_quotes) Bah. Cheap pun.

Or something with the database charset/collation or the connection charset/collation. Check phpMyAdmin to see if everything is UTF8. I have no idea how that would affect single quotes but stranger things have happened.

Quint’s picture

If I type in all the special characters

`1234567890-=~!@#$%^&*()_+[]\{}|;':",./<>?
`1234567890-=~!@#$%^&*()_+[]{}|;'':",./<>? this results

Backslash goes away and the apostrophe is doubled.

After playing with it a while it looks like it's turning double-backslashes into single ones, then if preceeded by a letter removing one.

Strange. Please let us know if you figure it out.

Quint
Shalla.Net

Quint’s picture

maybe you could install wordpress or something else on the same server and see if it happens in that app too. with Fantastico, it will only take a few minutes. If you install it to a sub-directory, it shouldn't mess things up. Or even some HTML page that lets you enter text into a box, like a "contact me" box.

Quint

JirkaRybka’s picture

I just got another small idea: Backslash vanished = it was taken as an escape character where wasn't supposed to be (quite common in unix/php to use strings like "something\." where alone dot will otherwise mean a feature rather than a character). Single quotes doubled = the extra quote inserted to serve as escape character, but NOT taken this way, and so it remains in the string to output (I'm not an expert on MySQL, but once I saw a query containing a string like 'someone''s thing' - here the doubled single quote means just single-quote alone, while the normal single-quote at the end is closing the string).

So, I think that there's a point in your Drupal installation, where the string is prepared to be used in the second syntax (i.e. quotes doubled), but then really thown into the first syntax (where quotes doesn't change back, but backslashes are misunderstood/removed instead).

I seem unable to find every relevant bit of code in a reasonable time, to figure out what happens, but perhaps your Drupal install mismatches string-escaping between different database types? I'm just guessing, but it might be worth a try, to look into your sites/default/settings.php to see if there is the correct database-type (i.e. "mysql://" or "mysqli://" or "pgsql://") to match your server config.

cog.rusty’s picture

This behavior looks somehow like what is described in the third magic quotes directive mentioned in that php.net page (magic_quotes_sybase), but I have no idea why they would have enabled that.

bsjeon: Can you run a

<?php print 'magic_quotes_sybase: ' . ini_get('magic_quotes_sybase');?>

and see whether it is enabled? (1 or 0)

bsjeon’s picture

Yes, the problem was the stupid 'magic_quotes_sybase'. It was somehow enabled in my drupal site. I still don't know why, but... as soon as I disabled it, the single quote and backslash problem were completely gone. Thank you all for your time and efforts. I was very impressed that the Drupal forum community is very active and supportive each other. :-)

- bsjeon

cog.rusty’s picture

I could never resist a little detective work! A while back I remember that there was also an issue where file uploads were silently failing if magic_quotes_gpc was enabled, so I got suspicious of all things magic.

fkiner’s picture

Got the same problem, but do not know where to look for "magic_quotes_gpc" to disable it and how... Please help.

cog.rusty’s picture

There are three magic_quotes settings:

magic_quotes_gpc
------------------
PHP default value 1, must be 0.
Can't be set at runtime in settings.php. It can be set
- either in php.ini with magic_quotes_gpc = 0
- or per directory in .htaccess with php_value magic_quotes_gpc 0
If you are using Drupal's .htaccess file, it is already set there.

magic_quotes_runtime
---------------------
PHP default value 0, must be 0
It is already set in Drupal's settings.php file with an ini_set('magic_quotes_runtime', 0);

magic_quotes_sybase
---------------------
PHP default value 0, must be 0
It is already set in Drupal's settings.php file with an ini_set('magic_quotes_sybase', 0);

csurocker’s picture

Hello

I am getting a weird character "�" in place >> please let me know how to get rid of this on my site...