WordPress.org

Make WordPress Core

Changeset 13347


Ignore:
Timestamp:
02/23/2010 10:42:54 PM (8 years ago)
Author:
nacin
Message:

Validate $object_id in *_metadata() functions. Props scribu fixes #11841

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/meta.php

    r13326 r13347  
    3333        return false;
    3434
     35    if ( !$object_id = absint($object_id) )
     36        return false;
     37
    3538    if ( ! $table = _get_meta_table($meta_type) )
    3639        return false;
     
    8487function update_metadata($meta_type, $object_id, $meta_key, $meta_value, $prev_value = '') {
    8588    if ( !$meta_type || !$meta_key )
     89        return false;
     90
     91    if ( !$object_id = absint($object_id) )
    8692        return false;
    8793
     
    139145 */
    140146function delete_metadata($meta_type, $object_id, $meta_key, $meta_value = '', $delete_all = false) {
    141     if ( !$meta_type || !$meta_key || (!$delete_all && ! (int)$object_id) )
     147    if ( !$meta_type || !$meta_key )
     148        return false;
     149
     150    if ( !$object_id = absint($object_id) && !$delete_all )
    142151        return false;
    143152
     
    196205        return false;
    197206
     207    if ( !$object_id = absint($object_id) )
     208        return false;
     209
    198210    $meta_cache = wp_cache_get($object_id, $meta_type . '_meta');
    199211
Note: See TracChangeset for help on using the changeset viewer.