Changeset 48439
- Timestamp:
- 07/11/2020 09:46:29 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/nav-menu.php
r48416 r48439 493 493 } 494 494 495 if ( wp_unslash( $args['menu-item-title'] ) == wp_specialchars_decode( $original_title ) ) {495 if ( wp_unslash( $args['menu-item-title'] ) === wp_specialchars_decode( $original_title ) ) { 496 496 $args['menu-item-title'] = ''; 497 497 } -
trunk/tests/phpunit/tests/post/nav-menu.php
r48416 r48439 417 417 ); 418 418 419 $post_inser 2 = wp_update_nav_menu_item(419 $post_insert2 = wp_update_nav_menu_item( 420 420 $this->menu_id, 421 421 0, … … 960 960 * Tests `wp_update_nav_menu_item()` with special characters in a category name. 961 961 * 962 * When inserting a category as a nav item, the ` $args['menu-item-title']`should963 * always be empty as itshould get the title from the category object itself.962 * When inserting a category as a nav item, the `post_title` property should 963 * be empty, as the item should get the title from the category object itself. 964 964 * 965 965 * @ticket 48011 966 966 */ 967 function test_wp_update_nav_menu_item_with_special_character_in_categories() { 968 967 function test_wp_update_nav_menu_item_with_special_characters_in_category_name() { 969 968 $category_name = 'Test Cat - \"Pre-Slashed\" Cat Name & >'; 970 969 971 $cat = self::factory()->category->create_and_get(970 $category = self::factory()->category->create_and_get( 972 971 array( 973 972 'name' => $category_name, … … 975 974 ); 976 975 977 add_action( 'wp_update_nav_menu_item', array( $this, 'callback_wp_update_nav_menu_item_48011' ), 10, 3 ); 978 979 wp_update_nav_menu_item( 976 $category_item_id = wp_update_nav_menu_item( 980 977 $this->menu_id, 981 978 0, … … 983 980 'menu-item-type' => 'taxonomy', 984 981 'menu-item-object' => 'category', 985 'menu-item-object-id' => $cat ->term_id,986 'menu-item-status' => 'publish', 987 /* *982 'menu-item-object-id' => $category->term_id, 983 'menu-item-status' => 'publish', 984 /* 988 985 * Interestingly enough, if we use `$cat->name` for the menu item title, 989 986 * we won't be able to replicate the bug because it's in htmlentities form. … … 992 989 ) 993 990 ); 994 } 995 996 /** 997 * Callback for the `wp_update_nav_menu_item` action. 998 * 999 * @since 5.5.0 1000 */ 1001 function callback_wp_update_nav_menu_item_48011( $menu_id, $menu_item_db_id, $args ) { 1002 $this->assertEmpty( $args['menu-item-title'] ); 991 992 $category_item = get_post( $category_item_id ); 993 $this->assertEmpty( $category_item->post_title ); 1003 994 } 1004 995 }
Note: See TracChangeset
for help on using the changeset viewer.