[wp-trac] [WordPress Trac] #48249: Check for int instead of null in new submenu priority implementation

WordPress Trac noreply at wordpress.org
Wed Oct 9 08:03:34 UTC 2019


#48249: Check for int instead of null in new submenu priority implementation
--------------------------+-----------------------------
 Reporter:  david.binda   |       Owner:  audrasjb
     Type:  defect (bug)  |      Status:  reviewing
 Priority:  normal        |   Milestone:  Future Release
Component:  Menus         |     Version:  trunk
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+-----------------------------

Comment (by david.binda):

 Hey @123host,

 > Can you explain what issues this might cause

 In the instances which I've been dealing with, the extra arguments
 (usually a string, due to the confusion with `add_menu_page`'s `$icon_url`
 param), have led to PHP warnings and even to missing menu items. The
 codebase I've been examining is rather complex, so I don't have a full
 chain for missing menu items. But can confirm that the proposed patch,
 which is preserving existing functionality for cases where the `$priority`
 param is incorrectly used (w/o being noticed for years), fixes the issue.

 > and the solution? Is it to simply remove
 >
 > , $petitions['icon_url']
 >
 > from add_submenu_page?

 Yes. Even if this patch lands in 5.3, then it would be better if all the
 `add_submenu_page` calls (as well as it's derivates, eg.:
 `add_options_page`) were using the correct number of args. Eg.: there is
 no icon URL for submenu pages - the 6th param of `add_submenu_page` in 5.3
 is going to be a priority and current code expects it being an int.


 @audrasjb , due to the breaking nature of the described bug , eventually
 leading to missing submenu pages (see above), in a code which is new in
 5.3, I would personally vote for patching it in RC. Aren't the beta
 releases intended for identifying bugs in new code for the release, so it
 can be patched before the final one?

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


More information about the wp-trac mailing list