From bb74249c0deafbe69e4b69288596d5e6b2727806 Mon Sep 17 00:00:00 2001 From: westi Date: Tue, 7 Jun 2011 08:55:25 +0000 Subject: [PATCH] Ensure that we always coerce the class list passed to get_body_class to an array even when it is empty. Fixes #17717 git-svn-id: http://svn.automattic.com/wordpress/trunk@18176 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/post-template.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wp-includes/post-template.php b/wp-includes/post-template.php index 593846e0b1..a2f5d1a563 100644 --- a/wp-includes/post-template.php +++ b/wp-includes/post-template.php @@ -529,10 +529,13 @@ function get_body_class( $class = '' ) { $classes[] = 'post-type-paged-' . $page; } - if ( !empty( $class ) ) { + if ( ! empty( $class ) ) { if ( !is_array( $class ) ) $class = preg_split( '#\s+#', $class ); $classes = array_merge( $classes, $class ); + } else { + // Ensure that we always coerce class to being an array. + $class = array(); } $classes = array_map( 'esc_attr', $classes );