From 6cbb6fecb3bd4d71bcd91c329a7f3deed3605f56 Mon Sep 17 00:00:00 2001 From: ryan Date: Wed, 6 Jul 2005 01:12:38 +0000 Subject: [PATCH] Stripslashes doesn't work on arrays. Add stripslashes_deep(). Props: Mike Little git-svn-id: http://svn.automattic.com/wordpress/trunk@2700 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/functions-formatting.php | 10 ++++++++++ wp-settings.php | 8 ++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/wp-includes/functions-formatting.php b/wp-includes/functions-formatting.php index fa8a4e584..3ad94f5df 100644 --- a/wp-includes/functions-formatting.php +++ b/wp-includes/functions-formatting.php @@ -532,6 +532,16 @@ function addslashes_gpc($gpc) { return $wpdb->escape($gpc); } + +function stripslashes_deep($value) +{ + $value = is_array($value) ? + array_map('stripslashes_deep', $value) : + stripslashes($value); + + return $value; +} + function antispambot($emailaddy, $mailto=0) { $emailNOSPAMaddy = ''; srand ((float) microtime() * 1000000); diff --git a/wp-settings.php b/wp-settings.php index 86db740bf..7439c63b1 100644 --- a/wp-settings.php +++ b/wp-settings.php @@ -138,10 +138,10 @@ require_once(ABSPATH . WPINC . '/locale.php'); // If already slashed, strip. if ( get_magic_quotes_gpc() ) { - $_GET = stripslashes($_GET ); - $_POST = stripslashes($_POST ); - $_COOKIE = stripslashes($_COOKIE); - $_SERVER = stripslashes($_SERVER); + $_GET = stripslashes_deep($_GET ); + $_POST = stripslashes_deep($_POST ); + $_COOKIE = stripslashes_deep($_COOKIE); + $_SERVER = stripslashes_deep($_SERVER); } // Escape with wpdb.