tags:

views:

80

answers:

3

Hi, Can anyone tell me what is the significance of the key magic_quotes_gpc in php.ini file.

+2  A: 

PHP's manual can tell you the significance:

Sets the magic_quotes state for GPC (Get/Post/Cookie) operations. When magic_quotes are on, all ' (single-quote), " (double quote), \ (backslash) and NUL's are escaped with a backslash automatically.

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

evolve
A: 

I spoils input data by adding some special characters to it.
Must be turned off

Col. Shrapnel
+1  A: 

It was used to insert user submitted data directly into mysql queries without having to escape it.

It's now depreceated and should be leaved to 'Off' until PHP removes it, I prefer handling string escaping by mysqelf or by th DB abstraction layer than relying on php directive for this.

The point is that GET/POST/COOKIE vars are not only for DB storage, and I've seen too much emails or displayed text showing \' characters because of this.

Benoit