WordPress.org

Make WordPress Core

Opened 3 months ago

Last modified 3 months ago

#46848 new defect (bug)

translate_level_to_role may return void in wp-admin/includes/upgrade.php

Reported by: diddledan Owned by:
Milestone: 5.3 Priority: normal
Severity: normal Version: 2.0
Component: Upgrade/Install Keywords: has-patch
Focuses: Cc:

Description

The function translate_level_to_role() is defined and used in wp-admin/includes/upgrade.php in the function upgrade_160. The usage requires that the function return a string or numeric to be used in a subsequent array key. The function may return void which cannot be used as a key. For correctness the function should always return a value. Patch attached adds a default selector to the switch statement to achieve this.

Attachments (1)

46848.diff (710 bytes) - added by diddledan 3 months ago.
patch to fix potentially returning void in translate_level_to_role() in upgrade.php

Download all attachments as: .zip

Change History (2)

@diddledan
3 months ago

patch to fix potentially returning void in translate_level_to_role() in upgrade.php

#1 @SergeyBiryukov
3 months ago

  • Milestone changed from Awaiting Review to 5.3
Note: See TracTickets for help on using tickets.