Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#44154 closed defect (bug) (invalid)

saving backslash backslash into user_meta does not round-trip

Reported by: ericscheid's profile ericscheid 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)

#1 follow-up: @johnbillion
7 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

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.

#2 in reply to: ↑ 1 @ericscheid
7 years ago

Thanks John.

This is not very well documented. See #41593.

An unenviable tech debt.

Note: See TracTickets for help on using tickets.