WordPress.org

Make WordPress Core

Opened 3 years ago

Last modified 5 months ago

#37627 new defect (bug)

Custom Fields Heading shows up when all meta values are serialized arrays/objects

Reported by: implenton Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Posts, Post Types Keywords: has-patch
Focuses: ui, administration Cc:
PR Number:

Description (last modified by SergeyBiryukov)

_list_meta_row skips the meta rows when the value is a serialized array/objects.

When all meta values are serialized arrays/objects OR when you only have one meta with the value being serialized array/object the table heading shows up:

https://cldup.com/sVKAp24YMF.png

https://cldup.com/0axQNTon98.png

There is a check for protected metas before the table rendering

wp-admin/includes/meta-boxes.php:631

$metadata = has_meta($post->ID);
foreach ( $metadata as $key => $value ) {
	if ( is_protected_meta( $metadata[ $key ][ 'meta_key' ], 'post' ) || ! current_user_can( 'edit_post_meta', $post->ID, $metadata[ $key ][ 'meta_key' ] ) )
		unset( $metadata[ $key ] );
}
list_meta( $metadata );

but it does not take in account meta values, which are skipped later.

This might be considered an edge case, but it is better to be noted.

Discovered this when I reported: #37626

Attachments (2)

meta-boxes.diff (755 bytes) - added by implenton 3 years ago.
Check for serialized array/objects values early
meta-boxes.2.diff (756 bytes) - added by implenton 3 years ago.
Check for serialized array/objects values early - fix space between ! and &&

Download all attachments as: .zip

Change History (6)

@implenton
3 years ago

Check for serialized array/objects values early

@implenton
3 years ago

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

#1 @implenton
3 years ago

I provided a .diff that makes sure that it checks early for serialized array/object meta values and fixes the issue I reported.

#2 @SergeyBiryukov
3 years ago

  • Component changed from General to Administration

Previously: #16214

#3 @SergeyBiryukov
3 years ago

  • Description modified (diff)

#4 @ocean90
3 years ago

  • Component changed from Administration to Posts, Post Types
  • Keywords has-patch added
  • Version trunk deleted
Note: See TracTickets for help on using tickets.