Link to home
Start Free TrialLog in
Avatar of MatthewP
MatthewPFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Magic Quotes Hell

So, I have a large app that works great, I move it over to another host, everything great except... I edit a page in the online editor (which uses tinyMCE), save it, and it appears back on the page with extra quotes, so what was:

<span class="title">GUARANTEE</span>

has become

<span class="\"title\"">GUARANTEE</span>

- actually worse because tiny mce is converting the extra quote in it to:
<span class="\&quot;title\&quot;">GUARANTEE</span>

I've added these to every script that either pulls data out or puts data into a database:

ini_set('magic_quotes_gpc','Off');
ini_set('magic_quotes_runtime','Off');
ini_set('magic_quotes_sybase','Off');

which I got from some web site. Unfortunately it does absolutely nothing at all. I guess it's something to do with stripslashes/addslashes and the default behaviour of that?

This app can sit on any possible host, is there a generic way that I can ensure this is worked out via a function (checking on values, running the appropriate behaviour? The server i developed this on doesnt use any magic_quotes or add/stripslashes in the actual php code and works perfectly, which is how i want it to be every time.

Thanks!
Matt


Avatar of Oddsen84
Oddsen84
Flag of Norway image

The answer might lie in the question... If you are using an online editor to edit it most likely has an html spescial char converter that converts all html chars into the aformentioned &nbsp; and similars. Could you try to edit the could the hard way by using notepad or wordpad?? See if this makes any difference :)
Just as a piece of extra info. The ? and other characters are so called control characters and are therefor interpreted in a different way than other characters.
ASKER CERTIFIED SOLUTION
Avatar of Rok-Kralj
Rok-Kralj
Flag of Slovenia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
So, this code detects setting... And if it is on, then it undoes directive...

DO NOT CHANGE ANY OF YOUR CODE, JUST ADD THIS TO TOP!

:D
Avatar of MatthewP

ASKER

Brilliant, thank you!

I've been through this before and couldn't remember what I did last time, only that I spent far longer on it that I really should. This works spot on.

Have to add, I am so glad they've deprecated this.

Thanks again.