[wp-trac] [WordPress Trac] #54798: Check for int in menu priority

WordPress Trac noreply at wordpress.org
Wed Jan 12 19:00:56 UTC 2022


#54798: Check for int in menu priority
--------------------------------------+------------------------
 Reporter:  kirtan95                  |       Owner:  audrasjb
     Type:  defect (bug)              |      Status:  reviewing
 Priority:  normal                    |   Milestone:  6.0
Component:  Administration            |     Version:
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:
--------------------------------------+------------------------
Description changed by SergeyBiryukov:

Old description:

> Similar to [https://core.trac.wordpress.org/ticket/48249], this ticket
> focuses on ensuring that devs don't accidentally pass non-integer values
> in the position argument.
>
> A similar issue was also reported in
> [https://core.trac.wordpress.org/ticket/40927], where passing a float
> argument in `add_menu_page` causes to override menu item.
>
> For backward compatibility, I'd like to suggest informing users with
> `_doing_it_wrong` if a non-integer value is passed.
>
> Optionally, we can also typecast float to string to ensure in case
> someone has passed float value, at least it doesn't override menus.

New description:

 Similar to #48249, this ticket focuses on ensuring that devs don't
 accidentally pass non-integer values in the position argument.

 A similar issue was also reported in #40927, where passing a float
 argument in `add_menu_page` causes to override menu item.

 For backward compatibility, I'd like to suggest informing users with
 `_doing_it_wrong` if a non-integer value is passed.

 Optionally, we can also typecast float to string to ensure in case someone
 has passed float value, at least it doesn't override menus.

--

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/54798#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list