Make WordPress Core

Opened 12 years ago

Closed 11 years ago

#23051 closed defect (bug) (fixed)

Menu with navigation label '0' gets removed

Reported by: zsero's profile zsero Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 3.6 Priority: normal
Severity: normal Version:
Component: Menus Keywords: has-patch commit
Focuses: Cc:

Description

There is no way to save a menu item with Navigation Label = 0 (zero). It gets removed. I think it's a bug in an if statement where 0 happens to be False or something similar.

Attachments (3)

23051.diff (473 bytes) - added by MikeHansenMe 12 years ago.
change empty to ! isset
23051.2.diff (1.3 KB) - added by kovshenin 12 years ago.
23051.3.diff (1.7 KB) - added by SergeyBiryukov 11 years ago.

Download all attachments as: .zip

Change History (12)

#1 @SergeyBiryukov
12 years ago

  • Component changed from General to Menus

#2 @toscho
12 years ago

  • Cc info@… added

@MikeHansenMe
12 years ago

change empty to ! isset

#3 @MikeHansenMe
12 years ago

  • Cc mdhansen@… added
  • Keywords has-patch needs-testing added

#4 @SergeyBiryukov
12 years ago

  • Milestone changed from Awaiting Review to 3.6

@kovshenin
12 years ago

#5 @kovshenin
12 years ago

In 23051.2.diff do a string length comparison, rather than empty or isset. Also refreshed for current trunk since things have moved around in menus. Or maybe it's just easier to compare to an empty string?

Last edited 12 years ago by kovshenin (previous) (diff)

#6 @MikeHansenMe
11 years ago

Just tested 23051.2.diff and it still applies to current trunk(3.6-beta2-24227).

#7 @SergeyBiryukov
11 years ago

I think we should have isset() in some of those checks.

23051.3.diff also simplifies the logic in wp_update_nav_menu_item().

#8 @SergeyBiryukov
11 years ago

  • Keywords commit added; needs-testing removed

#9 @SergeyBiryukov
11 years ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 24235:

Prevent menu items with '0' label from being removed on menu saving. props MikeHansenMe, kovshenin. fixes #23051.

Note: See TracTickets for help on using tickets.