From 8252125175c85911854d1f4ca70c3d90f7a8edd7 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sun, 6 Oct 2019 15:06:03 +0000 Subject: [PATCH] Menus: In `Walker_Nav_Menu`, `Walker_Category`, and `Walker_Page`, properly output link attributes having a legitimate "empty" value, for example an HTML data attribute with a value of zero (0). Props nevma, AkSDvP, greenshady, SergeyBiryukov. Fixes #47720. Built from https://develop.svn.wordpress.org/trunk@46413 git-svn-id: http://core.svn.wordpress.org/trunk@46211 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-walker-category.php | 2 +- wp-includes/class-walker-nav-menu.php | 2 +- wp-includes/class-walker-page.php | 2 +- wp-includes/version.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/wp-includes/class-walker-category.php b/wp-includes/class-walker-category.php index 997993710a..16ad852e5b 100644 --- a/wp-includes/class-walker-category.php +++ b/wp-includes/class-walker-category.php @@ -139,7 +139,7 @@ class Walker_Category extends Walker { $attributes = ''; foreach ( $atts as $attr => $value ) { - if ( ! empty( $value ) ) { + if ( is_scalar( $value ) && '' !== $value && false !== $value ) { $value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value ); $attributes .= ' ' . $attr . '="' . $value . '"'; } diff --git a/wp-includes/class-walker-nav-menu.php b/wp-includes/class-walker-nav-menu.php index 06070ed0c8..1d0fd714f7 100644 --- a/wp-includes/class-walker-nav-menu.php +++ b/wp-includes/class-walker-nav-menu.php @@ -203,7 +203,7 @@ class Walker_Nav_Menu extends Walker { $attributes = ''; foreach ( $atts as $attr => $value ) { - if ( ! empty( $value ) ) { + if ( is_scalar( $value ) && '' !== $value && false !== $value ) { $value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value ); $attributes .= ' ' . $attr . '="' . $value . '"'; } diff --git a/wp-includes/class-walker-page.php b/wp-includes/class-walker-page.php index 27e06c9b5d..eac5a4f9fd 100644 --- a/wp-includes/class-walker-page.php +++ b/wp-includes/class-walker-page.php @@ -182,7 +182,7 @@ class Walker_Page extends Walker { $attributes = ''; foreach ( $atts as $attr => $value ) { - if ( ! empty( $value ) ) { + if ( is_scalar( $value ) && '' !== $value && false !== $value ) { $value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value ); $attributes .= ' ' . $attr . '="' . $value . '"'; } diff --git a/wp-includes/version.php b/wp-includes/version.php index e6a78946a9..ae07930480 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.3-beta2-46412'; +$wp_version = '5.3-beta2-46413'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.