From b66da520b3b3dedfc5d2c14f75fdd8c334560984 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sun, 11 Feb 2018 14:52:03 +0000 Subject: [PATCH] Media: Make sure `$caption_id` does not depend on an undefined variable. See #34595. git-svn-id: https://develop.svn.wordpress.org/trunk@42692 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/media.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/wp-includes/media.php b/src/wp-includes/media.php index 4a97f445ef..1da6dcecd1 100644 --- a/src/wp-includes/media.php +++ b/src/wp-includes/media.php @@ -1556,13 +1556,14 @@ function img_caption_shortcode( $attr, $content = null ) { return $content; } + $caption_id = ''; + if ( ! empty( $atts['id'] ) ) { $att_id = esc_attr( sanitize_html_class( $atts['id'] ) ); $atts['id'] = 'id="' . $att_id . '" '; + $caption_id = 'caption-' . str_replace( '_', '-', $att_id ); } - $caption_id = 'caption-' . str_replace( '_', '-', $att_id ); - $class = trim( 'wp-caption ' . $atts['align'] . ' ' . $atts['class'] ); $html5 = current_theme_supports( 'html5', 'caption' );