[wp-trac] [WordPress Trac] #47720: Walker_Nav_Menu filter nav_menu_link_attributes checks $atts argument via empty() and not isset(), causing confusion with legitimate values that evaluate to boolean false
WordPress Trac
noreply at wordpress.org
Wed Jul 17 14:02:23 UTC 2019
#47720: Walker_Nav_Menu filter nav_menu_link_attributes checks $atts argument via
empty() and not isset(), causing confusion with legitimate values that
evaluate to boolean false
-------------------------------------+------------------------------
Reporter: nevma | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Menus | Version: 5.2.2
Severity: normal | Resolution:
Keywords: has-patch needs-testing | Focuses: template
-------------------------------------+------------------------------
Changes (by AkSDvP):
* keywords: needs-patch => has-patch needs-testing
Comment:
Key differences between both methods is-
isset - Determine if a variable is set and is not NULL.
!empty - Determine whether a variable is NOT empty.
Considering the above point I have replaced
if ( ! empty( $value ) )
with
if ( isset( $value ) )
--
Ticket URL: <https://core.trac.wordpress.org/ticket/47720#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list