[wp-trac] [WordPress Trac] #42195: wp_slash() is lossy
WordPress Trac
noreply at wordpress.org
Fri Sep 14 05:32:25 UTC 2018
#42195: wp_slash() is lossy
-------------------------------------------------+-------------------------
Reporter: johnbillion | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting
| Review
Component: Formatting | Version:
Severity: normal | Resolution:
Keywords: needs-patch dev-feedback has-unit- | Focuses:
tests |
-------------------------------------------------+-------------------------
Comment (by ryotasakamoto):
I think that it can be corrected below, but is there something wrong?
{{{
function wp_slash( $value ) {
if ( is_array( $value ) ) {
foreach ( $value as $k => $v ) {
if ( is_array( $v ) ) {
$value[ $k ] = wp_slash( $v );
} else {
if (is_bool( $v )) {
$v = (int) $v;
}
$value[ $k ] = addslashes( $v );
}
}
} else {
if ( is_bool( $value ) ) {
$value = (int) $value;
}
$value = addslashes( $value );
}
return $value;
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/42195#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list