User Contributed Notes 5 notes

You should NEVER rely on magic quotes or addslashes for security in an SQL context. You should ALWAYS use proper escape functions, such as mysql_real_escape_string. Failure to do so may result in an SQL injection vulnerability.

get_magic_quotes runtime and set_magic_quotes_runtime are useful when you want to read some data in a binary file using fread() and some bytes in such file may be interpreted as \ (backslash), " (double quotes), ' (simple quote) or any "special" character that has a meaning for string processing.