Ticket #5718: add_post_meta-cache-corruption.diff
| File add_post_meta-cache-corruption.diff, 803 bytes (added by nbachiyski, 4 years ago) |
|---|
-
wp-includes/post.php
485 485 if ( $unique && $wpdb->get_var( $wpdb->prepare( "SELECT meta_key FROM $wpdb->postmeta WHERE meta_key = %s AND post_id = %d", $meta_key, $post_id ) ) ) 486 486 return false; 487 487 488 $cache = wp_cache_get($post_id, 'post_meta');489 if ( ! is_array($cache) )490 $cache = array();491 // expected_slashed ($meta_key)492 $cache[$wpdb->escape($meta_key)][] = $meta_value;493 494 wp_cache_set($post_id, $cache, 'post_meta');495 496 488 $meta_value = maybe_serialize($meta_value); 497 489 498 490 $wpdb->insert( $wpdb->postmeta, compact( 'post_id', 'meta_key', 'meta_value' ) ); 491 492 wp_delete_cache($post_id, 'post_meta'); 493 499 494 return true; 500 495 } 501 496
