views:

60

answers:

4

A client's web host recently changed servers on them and it's broken some of the administrative tools. I'm providing a YUI WYSIWYG editor for them to create content on the site. The HTML content is now being "cleaned" by something before I get to it. For example, a link tag like

<a href="http://www.stackoverflow.com"&gt;

gets turned into

<a href=\">

Does this sound like a PHP server setting? If so, which one and can I control it via a php.ini file?

+2  A: 

Make sure to set magic_quotes_gpc = Off in the php.ini file on that host. That will keep PHP from adding slashes to the HTML chars <, >, ", and '. As for the inner link URL disappearing - that must be from the JS editor or from a custom PHP filter in the system. PHP it's self doesn't filter content (other than adding slashes).

Xeoncross
+2  A: 

I'm not saying I know them all, but it doesn't sound like any normal setting I've heard of. Looks slightly like magic_quotes, but with far crazier consequences.

How about urlencoding data before it's passed? It may not be pretty, but it would work.

Dereleased
+1  A: 

It may be a combination of the WYSIWYG editor and magic_quotes_gpc being enabled.

Does the HTML get altered only after the client saves the changes?

To try and Isolate the problem, see what happens when you take the WYSIWYG out of the picture.

Disable the WYSIWYG and see what the output looks like when the data is submitted via the form and retrieved from the DB.

Good luck - let us know how you go with it.

rvdavid
+1  A: 

I'm a putz. It was magic quotes. It's been so long since I've run into a server with it turned on that I never even thought of it. On the plus side, I now know the bit of code I'd written to handle the situation when magic_quotes was turned on does not work. I think it was the combination of the two that was over-escaping the HTML so the link got munged. Thanks everyone.

Tom