Make WordPress Core

Ticket #17445: 17445.patch

File 17445.patch, 3.7 KB (added by hakre, 14 years ago)
  • wp-admin/network/site-settings.php

    ### Eclipse Workspace Patch 1.0
    #P wordpress
     
    111111                        $disabled = false;
    112112                        $class = 'all-options';
    113113                        if ( is_serialized( $option->option_value ) ) {
    114                                 if ( is_serialized_string( $option->option_value ) ) {
    115                                         $option->option_value = esc_html( maybe_unserialize( $option->option_value ), 'single' );
     114                                if ( _is_serialized_test( 's', $option->option_value ) ) {
     115                                        $option->option_value = esc_html( @unserialize( $option->option_value ), 'single' );
    116116                                } else {
    117117                                        $option->option_value = 'SERIALIZED DATA';
    118118                                        $disabled = true;
  • wp-admin/options.php

     
    180180        if ( $option->option_name == '' )
    181181                continue;
    182182        if ( is_serialized( $option->option_value ) ) {
    183                 if ( is_serialized_string( $option->option_value ) ) {
     183                if ( _is_serialized_test( 's', $option->option_value ) ) {
    184184                        // this is a serialized string, so we should display it
    185                         $value = maybe_unserialize( $option->option_value );
     185                        $value = @unserialize( $option->option_value );
    186186                        $options_to_update[] = $option->option_name;
    187187                        $class = 'all-options';
    188188                } else {
  • wp-includes/functions.php

     
    276276}
    277277
    278278/**
     279 * Check whether serialized data is of a format defined by char.
     280 *
     281 * Used internally to prevent running is serialized too much.
     282 *
     283 * @access private
     284 * @param string $char to test for, e.g. 's' for strings.
     285 * @param mixed $data to test
     286 * @param bool $fullcheck (optional) by default, this functions precodnition is, that $data is of such a format that {@see is_serialized()}} has returned true on. Set this parameter to true to perform this precondition check in case not.
     287 * @return bool
     288 */
     289function _is_serialized_test($char, $data, $fullcheck = false) {
     290        if ($fullcheck && !is_serialized($data)) {
     291                return false;
     292        }
     293        return $char === strtolower( $data[ strcspn( $data, 'adObisS:"{};' ) ] );
     294}
     295
     296/**
    279297 * Check whether serialized data is of string type.
    280298 *
    281299 * @since 2.0.5
  • wp-admin/includes/post.php

     
    719719        $meta = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->postmeta WHERE meta_id = %d", $mid) );
    720720        if ( empty($meta) )
    721721                return false;
    722         if ( is_serialized_string( $meta->meta_value ) )
    723                 $meta->meta_value = maybe_unserialize( $meta->meta_value );
     722        if ( _is_serialized_test( 's', $meta->meta_value, true ) )
     723                $meta->meta_value = @unserialize( $meta->meta_value );
    724724        return $meta;
    725725}
    726726
  • wp-admin/includes/template.php

     
    478478                $style .= ' hidden';
    479479
    480480        if ( is_serialized( $entry['meta_value'] ) ) {
    481                 if ( is_serialized_string( $entry['meta_value'] ) ) {
     481                if ( _is_serialized_test( 's', $entry['meta_value'] ) ) {
    482482                        // this is a serialized string, so we should display it
    483                         $entry['meta_value'] = maybe_unserialize( $entry['meta_value'] );
     483                        $entry['meta_value'] = @unserialize( $entry['meta_value'] );
    484484                } else {
    485485                        // this is a serialized array/object so we should NOT display it
    486486                        --$count;