[wp-trac] [WordPress Trac] #42069: Saving metadata fails (randomly) if equal value already exists

WordPress Trac noreply at wordpress.org
Wed May 23 09:45:48 UTC 2018


#42069: Saving metadata fails (randomly) if equal value already exists
--------------------------+------------------------------
 Reporter:  JVel          |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  REST API      |     Version:  4.8.2
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:  rest-api
--------------------------+------------------------------

Comment (by MattGeri):

 I'm encountering this issue too. I've looked at the patch and my
 suggestion would be that you remove the sanitization from the old value as
 it's already unslashed and sanitized. Sanitization and unslashing should
 only be applied to `$meta_value`.

 So the conditional could read something like this, to satisfy all the
 usecases and tests:

 `if ( $old_value[0] === sanitize_meta( $meta_key, wp_unslash( $meta_value
 ), $meta_type ) ) {`

 Let me know your thoughts and if you agree but can't make the changes to
 the patch, I'd be happy to.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/42069#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list