Make WordPress Core


Ignore:
Timestamp:
09/23/2013 08:31:01 PM (12 years ago)
Author:
nacin
Message:

Return false in update_metadata() and update_metadata_by_mid() when the DB query fails.

props leewillis77.
fixes #24933.

File:
1 edited

Legend:

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

    r25525 r25583  
    152152        do_action( 'update_postmeta', $meta_id, $object_id, $meta_key, $meta_value );
    153153
    154     $wpdb->update( $table, $data, $where );
     154    $result = $wpdb->update( $table, $data, $where );
     155    if ( ! $result )
     156        return false;
    155157
    156158    wp_cache_delete($object_id, $meta_type . '_meta');
     
    436438
    437439        // Run the update query, all fields in $data are %s, $where is a %d.
    438         $result = (bool) $wpdb->update( $table, $data, $where, '%s', '%d' );
     440        $result = $wpdb->update( $table, $data, $where, '%s', '%d' );
     441        if ( ! $result )
     442            return false;
    439443
    440444        // Clear the caches.
     
    446450            do_action( 'updated_postmeta', $meta_id, $object_id, $meta_key, $meta_value );
    447451
    448         return $result;
     452        return true;
    449453    }
    450454
Note: See TracChangeset for help on using the changeset viewer.