Reputation: 1397
Recently I have been faced with the problematics that magic_quotes provides. I did notice that there were 3 different type(s) however which does what?
I know it's always good practice to do a check for enabled magic quotes but which ones should be check if not just GPC?
if (get_magic_quotes_gpc() || get_magic_quotes_runtime()) {
$string = stripslashes($string);
}
I want to be able to have something similar to this that runs in any code that I do so that way if ever an issue with the server I am working with it will fix any magic quote issues.
How would you guys/girls perform the check that's successful or is this completely correct?
Upvotes: 0
Views: 115
Reputation: 360672
magic_quotes_gpc() applies to data coming from (G)ET, (P)OST, and (C)OOKIEs
magic_quotes_runtime() applies to data coming in from ANY source (file_get_contents(), fread(), etc...)
magic_quotes_sybase switches between escaping with a single quote ('
) and a backslash (\
), as not all databases use backslashes for escaping (like sybase).
Upvotes: 1