RCU Forums - View Single Post - RCU administrator
View Single Post
Old 04-20-2008 | 10:13 AM
  #7  
gboulton's Avatar
gboulton
My Feedback: (15)
 
Joined: May 2005
Posts: 3,743
Likes: 0
Received 0 Likes on 0 Posts
From: La Vergne, TN
Default RE: RCU administrator

I have no idea if there's any "progress", CG...not being an RCU Admin and all. *heh*

But, for what it's worth (and, mostly, it's probably worth killing a few minutes of time reading it, and not much more) I can EXPLAIN the behaviour. *heh*

Most database engines use the single quote to denote something is text. For example, if you say to a database:

Give me everything that = the word BOB

you'd do it as such:

SELECT * FROM SOME_TABLE WHERE NAME=`BOB` (Note, those would be single quotes, but the problem we'rediscussing makes me use the ` *heh*)

If you don't wrap it up with single quotes, the database will probably expect BOB to be either some variable, or a column name in a table, or something like that...rather than the letters B-O-B as a string of text.

Now...because of this, whenever you're INSERTING something into a database, such as a meaningless time-wasting post about single quotes, if the content of the post has a single quote in it (like, the apostrophe in you're) then this can confuse the database. Why? Because when you send the text to the DB, you START it with a single quote, and the apostrophe hanging out in the middle in some contraction makes the DB think the text of the post STOPS THERE...it then wonders what the **** all this stuff (the remainder of the post after the apostrophe) is after the text.

So...you "escape" the apostrophe...that is, you tell the DB "no no, this isn't a single quote to end the text, I actually want the apostrophe as PART OF the text". In a large percentage of the world's db engines...you do this by putting another single quote in front of it. So, your system (the RCU forums in this case) looks at the text of your post, and replaces every apostrophe with TWO apostrophes...and then sends the content to the database.

My GUESS is that, somewhere, this process is being "duplicated"...that is, there's some more code somewhere taking the ALREADY MODIFIED "double apostrophe", and doubling them up again...which means, essentially, we're "escaping" TWO apostrophes. *heh*

Of course, when you then edit, the problem is repeated...you submit a post that now has TWO apostrophes, which the forum escapes (sending, thus, 4 to the db)...and the "problem code" then escapes ALL FOUR OF THOSE, so they show up in your edited post. *heh*

Edit again? We escape all 4, sending 8, which then get "re-escaped"...and so on.

So there you have it. *shrug*