From 82a44c5a3b110f28e725ebda4d0d027f7da0d03f Mon Sep 17 00:00:00 2001 From: Peter Westwood Date: Thu, 20 May 2010 21:16:44 +0000 Subject: [PATCH] Attempt to make stripslashes_deep object safe. See #12860 git-svn-id: https://develop.svn.wordpress.org/trunk@14766 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/formatting.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php index 8710b7159c..eebaace2d1 100644 --- a/wp-includes/formatting.php +++ b/wp-includes/formatting.php @@ -1226,7 +1226,17 @@ function addslashes_gpc($gpc) { * @return array|string Stripped array (or string in the callback). */ function stripslashes_deep($value) { - $value = is_array($value) ? array_map('stripslashes_deep', $value) : stripslashes($value); + if ( is_array($value) ) { + $value = array_map('stripslashes_deep', $value); + } elseif ( is_object($value) ) { + $vars = get_object_vars( $value ); + foreach ($vars as $key=>$data) { + $value->{$key} = stripslashes_deep( $data ); + } + } else { + $value = stripslashes($value); + } + return $value; }