#44154 closed defect (bug) (invalid)
saving backslash backslash into user_meta does not round-trip
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | critical | Version: | 4.9.5 |
| Component: | General | Keywords: | |
| Focuses: | Cc: |
Description
This code:
$user_id = get_current_user_id();
$input = 'double ' .chr(92) . chr(92) . ' slashes';
update_user_meta($user_id, 'update_meta_bug', $input);
$output = get_user_meta($user_id, 'update_meta_bug', true);
if ( $output != $input ) {
echo '<b>$output != $input</b>';
}
Produces this output:
$output != $input
Change History (2)
Note: See
TracTickets for help on using
tickets.
Thanks for the report, @ericscheid . The meta functions expect slashed data. Yes this is nasty, but that's the unfortunate position we're in. You can pass the value through
wp_slash()before passing it into this function.This is not very well documented. See #41593.