Although magic_quotes are turned off still escaped strings?
Asked Answered
D

1

5

I disabled magic_quotes in my php.ini.

But I still get escaped strings in my form.

Note: I'm running this in a theme in Wordpress.

Daukas answered 28/9, 2010 at 11:14 Comment(0)
D
8

I actually already figured this out, just want to leave my solution here in case other people might find it useful:

Wordpress automatically escapes all request variables. If magic quotes are turned off, they strip the slashes first, but add them again afterwards.

wp-settings.php code piece:

// If already slashed, strip.
if ( get_magic_quotes_gpc() ) {
$_GET = stripslashes_deep($_GET );
$_POST = stripslashes_deep($_POST );
$_COOKIE = stripslashes_deep($_COOKIE);
}


// Escape with wpdb.
$_GET = add_magic_quotes($_GET );
$_POST = add_magic_quotes($_POST );
$_COOKIE = add_magic_quotes($_COOKIE);
$_SERVER = add_magic_quotes($_SERVER);

Source: http://www.wptextads.com/blog/2007/05/19/gpc-magic-quotes-in-wordpress-is-compulsory/

Daukas answered 28/9, 2010 at 11:16 Comment(1)
more recently, this happens in wp-includes/load.php which wp-settings.php includesConformity

© 2022 - 2024 — McMap. All rights reserved.