Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are magic quotes runtime in PHP?

I'm totally aware of the aberration of Magic Quotes in PHP, how it is evil and I avoid them like pest, but what are magic_quotes_runtime? From php.ini:

Magic quotes for runtime-generated data, e.g. data from SQL, from exec(), etc.

Is is something I should check if ON and turn OFF with:

set_magic_quotes_runtime(false);

Is it often ON by default? I know it's deprecated in 5.3.0 and removed in 6.0.0 but since my script support 5.1.0+ I would like to know how to handle this in "legacy" PHP (if it's relevant).

Edit: To make things clear I want to exit('Turn OFF Magic Quotes'); when Magic quotes are ON. I'm not relying on them!

like image 968
AlexV Avatar asked Jan 22 '10 15:01

AlexV


People also ask

What is magic quote in PHP?

Magic quotes was a feature of the PHP scripting language, wherein strings are automatically escaped—special characters are prefixed with a backslash—before being passed on. It was introduced to help newcomers write functioning SQL commands without requiring manual escaping.

What is magic_ quotes_ runtime?

If magic_quotes_runtime is enabled, most functions that return data from any sort of external source including databases and text files will have quotes escaped with a backslash. If magic_quotes_sybase is also on, a single-quote is escaped with a single-quote instead of a backslash.

What is magic quotes GPC?

Phpinfo() PHP Magic Quotes Gpc is On The PHP magic_quotes_gpc is a process that automatically escapes all the incoming data to the PHP script. The details about PHP magic_quotes_gpc can be viewed using phpinfo(). If an attacker successfully executes phpinfo(), he will be able to view all the details about the server.


1 Answers

If magic_quotes_runtime is enabled, most functions that return data from any sort of external source including databases and text files will have quotes escaped with a backslash. If magic_quotes_sybase is also on, a single-quote is escaped with a single-quote instead of a backslash.

http://www.php.net/manual/en/info.configuration.php#ini.magic-quotes-runtime

like image 171
mck89 Avatar answered Sep 20 '22 07:09

mck89