PDA

View Full Version : Strip slashes mysteriously started appearing in links



Harold Mansfield
05-22-2010, 05:41 PM
For some reason, whenever I put links in my text widgets and save...it populates strip slashes around the quotes.1
So this:

<a href="http://nyblogs.net/activity/"><img src="http://nyblogs.net/files/2010/05/nysample.jpg"></a>
Turns into this:

<a href=\\\"http://nyblogs.net/activity/\\\"><img src=\\\"http://nyblogs.net/files/2010/05/nysample.jpg\\\"></a>


All by itself.

This just started happening today, and it is not happening on but one of my Wordpress sites.

I don't know why. I have backtracked any possible reasons, deactivated all plugins and it still persists.

Does anyone have any idea why this would be happening?
In 3 years of messing with Wordpress, I have never seen this before.

In Checking online, I see that they are called "Magic Quotes" but I have no clue why they started showing up all of a sudden.

Any Clue? Anyone?

Edited: I knew this day started out too good to be true. I got up early and was going to get a lot done, and then this started and stopped me cold from doing any work at all.

3 years of using Wordpress and countless installations, customizations and set ups and I have never encountered mysterious characters being automatically added to anything, let alone simple link code.

I have never seen anything so frustrating. Why would anyone or anything insert any kind of function that would do this to a simple link?
Why would this just start out of the blue?

vangogh
05-22-2010, 10:46 PM
Are you using a new theme by any chance? The why could be how the theme is handling quotes. If you're using a theme you've used before that wasn't showing the slashes, I'm not really sure why they'd appear.

You can try a few things. Use single quotes instead of double. My guess is the same thing will be happen, but it's easy enough to try.

Escape the quotes by adding one slash in front:


<a href=/"http://nyblogs.net/activity//"><img src="/http://nyblogs.net/files/2010/05/nysample.jpg/"></a>

It could be an issue in your database. You might have set it up with the wrong encoding. Here's how to fix (http://www.ben-huddleston.com/wordpress/installing-wordpress-fixing-question-marks-in-content/). If it's a brand new installation with no real data you may want to just set up a new database with the encoding set to utf-8.

I think the issue may be the database one. That was happening to me once and I think that was the issue.

Harold Mansfield
05-22-2010, 11:10 PM
Are you using a new theme by any chance? The why could be how the theme is handling quotes. If you're using a theme you've used before that wasn't showing the slashes, I'm not really sure why they'd appear.

You can try a few things. Use single quotes instead of double. My guess is the same thing will be happen, but it's easy enough to try.

Escape the quotes by adding one slash in front:


<a href=/"http://nyblogs.net/activity//"><img src="/http://nyblogs.net/files/2010/05/nysample.jpg/"></a>

It could be an issue in your database. You might have set it up with the wrong encoding. Here's how to fix (http://www.ben-huddleston.com/wordpress/installing-wordpress-fixing-question-marks-in-content/). If it's a brand new installation with no real data you may want to just set up a new database with the encoding set to utf-8.

I think the issue may be the database one. That was happening to me once and I think that was the issue.

It's only happening on this one installation. I'm using the same theme on another installation and don't have this problem.

It just started this morning. I have been building this site for 3 days with no problems.

I am currently on my 3rd call to my host to fix it since I have done everything I can on my end, right down to stripping down everything but the actual installation of MU itself, and it still does it.

It is UTF-8 by the way.
I looked at the article and it is about ???'s in content. I don't have that problem, I'm getting \\\'s added to every link, image path or anything with quotes, which is pretty much everything.

vangogh
05-22-2010, 11:21 PM
It could be your host then. A number of the other problems you've encountered have turned out to be hosting related. It's possible they turned something on or off that they shouldn't have.

Harold Mansfield
05-22-2010, 11:33 PM
They swear they haven't changed anything. But I did. I forgot to mention that his all started after I upgraded to the new version of Buddypress and it's been hell ever since.

vangogh
05-22-2010, 11:43 PM
Hmm? I have a feeling it's something in the way the information is being stored in the database because you're getting 3 slashes instead of one. I think one of those slashes is getting added when the info gets stored and then the 2 other slashes are attempts to escape the slash that was added and the quote.

One fix you can try is looking in the database for that link in the widget and removing any slashes in there. That won't necessarily solve the problem for the next time you add a link in a widget, but it might fix this one. At the very least you could see if the slashes are being written to the database or if they only appear after reading from the database.

Harold Mansfield
05-23-2010, 12:29 AM
I had my host completely disable "Magic Quotes", which by the way, I can't understand how this makes any sense at all and how anyone coded this into databases.
It makes no sense to have something that ignores what you type, especially with something as common as adding a link or embedding an image...that's 80% of what everyone does.

Anyway, I'm now only getting one slash and I reverted back to the old version of BP hours ago.

vangogh
05-23-2010, 12:47 AM
Things like magic quotes are a solution to the problem where a character you enter into the database also happens to be a special character in a programming language. When php sees something like a quote it needs to know it you literally want to display a quote or if it's part of command instructions.

Magic quotes would automatically escape quotes and other data. It was an old solution that is no longer necessary and it should never have been turned on in the first place. Just curious, but what makes you stick with your current host. A lot of the problems you've mentioned here have usually been because of something your host did or didn't do. Why not find a better host?

billbenson
05-23-2010, 01:12 AM
Have you looked at the actual db characters in phpmyadmin to see if they are actually there. The characters could be getting inserted into the database when they are supposed to just tell the db that a " or a few other characters are data, not php characters. It could also be happening when data is being read from the db.

Is the table type MYISAM? that can create problems as well.

Harold Mansfield
05-23-2010, 03:03 AM
Have you looked at the actual db characters in phpmyadmin to see if they are actually there. The characters could be getting inserted into the database when they are supposed to just tell the db that a " or a few other characters are data, not php characters. It could also be happening when data is being read from the db.



I wouldn't even begin to know where to look, which tables should I be checking, or do I check all of them?

Harold Mansfield
05-23-2010, 03:13 AM
. A lot of the problems you've mentioned here have usually been because of something your host did or didn't do. Why not find a better host?

First off, I'm not moving 50+ sites.
The other thing is, I knew when I got with them that they were more advanced than the average hosting company in that, they don't hold your hand, they expect you to know what you are doing and basically act as administrators to your commands.
A lot of the short comings I have had have been my lack of knowledge.

I've had a tech guy in the phone most of the day hunting down the problem and even now, I have a guy working on it over night to figure out why it's only happening on one site, where there are multiple sites on the account, on the same VPS that don't have a problem...so I can't really say they suck. They will find it and fix it.
I have dealt with a few hosting companies over the last few months, and based on what I have seen...I'm with a pretty good company. I wouldn't host an email account with most of the companies that I have worked with.

Not only that, but I can't put everything on them. Buddypress and Wordpress MU (together) are not completely stable and have a lot of bugs. It's not like the problems I incur are mine alone, they are talked about across the web and most times it's a problem with the platform or a combination of scripts and plug ins that I am trying to cram together to make it do something that it wasn't meant to do . I can't blame my host for that.

Nor can I blame them because my FTP program drops files.

When I call and ask them to do something, they do it immediately and when I screw something up, they bail me out and fix it.
Move where?

Harold Mansfield
05-23-2010, 01:30 PM
Well, well, well...it appears that I have found the fix. I re uploaded my wp-includes folder and the problem went away. Just like that.

I don't know if I'm happy that I can get back to work, or mad that I wasted an entire Saturday for something I could have done in 5 minutes.

billbenson
05-23-2010, 03:23 PM
Look at all of the tables and compare it to a working site. Click on the main db, not individual tables in phpmyadmin . That will give you a listing of the table structure for all of the tables. Compare this to the tables of a working site.

jamestl2
05-23-2010, 06:26 PM
So you just tried upgrading Buddypress and the strip slashes started to appear? Was it in just the widget section?

Since re-uploading wp-includes worked, perhaps there's a bug in the latest BP release pertaining to it.

Harold Mansfield
05-23-2010, 07:26 PM
So you just tried upgrading Buddypress and the strip slashes started to appear? Was it in just the widget section?

Since re-uploading wp-includes worked, perhaps there's a bug in the latest BP release pertaining to it.

I still don't know what triggered it. One thing that I am finding out, especially since I noticed my FTP skipping files, is that you can get what appears to be a clean installation and still be missing one file (out of thousands), and it will work just fine until you need that one thing and then all hell breaks loose.