Attempt to make stripslashes_deep object safe. See #12860
git-svn-id: http://svn.automattic.com/wordpress/trunk@14766 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
3f443689ed
commit
e8b8361ffe
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue