WordPress.org

Make WordPress Core

Ticket #37627: meta-boxes.2.diff

File meta-boxes.2.diff, 756 bytes (added by implenton, 4 years ago)

Check for serialized array/objects values early - fix space between ! and &&

  • meta-boxes.php

     
    630630<?php
    631631$metadata = has_meta($post->ID);
    632632foreach ( $metadata as $key => $value ) {
    633         if ( is_protected_meta( $metadata[ $key ][ 'meta_key' ], 'post' ) || ! current_user_can( 'edit_post_meta', $post->ID, $metadata[ $key ][ 'meta_key' ] ) )
     633        if ( is_protected_meta( $metadata[ $key ][ 'meta_key' ], 'post' ) || ( is_serialized( $metadata[ $key ][ 'meta_value' ] ) && ! is_serialized_string( $metadata[ $key ][ 'meta_value' ] ) ) || ! current_user_can( 'edit_post_meta', $post->ID, $metadata[ $key ][ 'meta_key' ] ) )
    634634                unset( $metadata[ $key ] );
    635635}
    636636list_meta( $metadata );