WordPress.org

Make WordPress Core

Changeset 3234


Ignore:
Timestamp:
11/29/05 07:58:50 (8 years ago)
Author:
matt
Message:

Part of a healthy balanced breakfast - fixes #1980

File:
1 edited

Legend:

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

    r3229 r3234  
    258258 
    259259 
     260function maybe_unserialize($original) { 
     261    if ( $gm = @ unserialize($original) ) 
     262        return $gm; 
     263    else 
     264        return $original; 
     265} 
     266 
    260267/* Options functions */ 
    261268 
     
    287294        $value = preg_replace('|/+$|', '', $value); 
    288295 
    289     @ $kellogs = unserialize($value); 
    290     if ( $kellogs !== FALSE ) 
    291         return apply_filters('option_' . $setting, $kellogs); 
    292     else 
    293         return apply_filters('option_' . $setting, $value); 
     296    return apply_filters( 'option_' . $setting, maybe_unserialize($value) ); 
    294297} 
    295298 
     
    329332        if ( 'category_base' == $option->option_name ) 
    330333            $option->option_value = preg_replace('|/+$|', '', $option->option_value); 
    331         @ $value = unserialize($option->option_value); 
    332         if ( $value === FALSE ) 
    333             $value = $option->option_value; 
     334        $value = maybe_unserialize($option->option_value); 
    334335        $all_options->{$option->option_name} = apply_filters('pre_option_' . $option->option_name, $value); 
    335336    } 
     
    460461    if ( isset($post_meta_cache[$post_id][$key]) ) { 
    461462        if ( $single ) { 
    462             return $post_meta_cache[$post_id][$key][0]; 
     463            return maybe_unserialize( $post_meta_cache[$post_id][$key][0] ); 
    463464        } else { 
    464             return $post_meta_cache[$post_id][$key]; 
     465            return maybe_unserialize( $post_meta_cache[$post_id][$key][0] ); 
    465466        } 
    466467    } 
     
    477478    if ( $single ) { 
    478479        if ( count($values) ) { 
    479             $return = $values[0]; 
     480            $return = maybe_unserialize( $values[0] ); 
    480481        } else { 
    481482            return ''; 
     
    485486    } 
    486487 
    487     @ $kellogs = unserialize($return); 
    488     if ( $kellogs !== FALSE ) 
    489         return $kellogs; 
    490     else return $return; 
     488    return maybe_unserialize($return); 
    491489} 
    492490 
Note: See TracChangeset for help on using the changeset viewer.