WordPress.org

Make WordPress Core

Ticket #32816: 32816.diff

File 32816.diff, 685 bytes (added by RMarks, 3 years ago)

return a WP_Error when the return value of esc_url_raw() is empty

  • class-wp-customize-nav-menu-item-setting.php

     
    723723                $menu_item_value['description'] = wp_unslash( apply_filters( 'content_save_pre', wp_slash( $menu_item_value['description'] ) ) );
    724724
    725725                $menu_item_value['url'] = esc_url_raw( $menu_item_value['url'] );
     726                if( '' === $menu_item_value['url'] ) {
     727                        return new WP_Error( 'invalid_url', __( 'Invalid URL.' ) );
     728                }
    726729                if ( 'publish' !== $menu_item_value['status'] ) {
    727730                        $menu_item_value['status'] = 'draft';
    728731                }