Make WordPress Core

Opened 11 months ago

Last modified 8 months ago

#56254 new defect (bug)

PHP Warning: Undefined array key 1 wp-admin\menu-header.php on line 202

Reported by: pras88in's profile pras.88in Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Administration Keywords: php81 has-patch needs-unit-tests
Focuses: Cc:

Description

i get the above warning when i use php version 8.1.6 in iis server,for php7.427 the code works , am using wordpress 6.0.1 released on jul 12 2022, am unable to fix it , kindly support , i get this error after succesfull login as admimistrator in plugin.php page , and other admin pages.

Change History (3)

#1 @sabernhardt
10 months ago

  • Component changed from General to Administration
  • Keywords php81 added

Hi and welcome to Trac!

If you want site support, the support forums would be a better place to ask:
https://wordpress.org/support/forums/

However, I'll leave this ticket open for now. The undefined key is the user capability needed to display a sub-menu item in the side admin menu, and maybe the condition needs to check whether the key is set/non-empty before using current_user_can().

Last edited 10 months ago by sabernhardt (previous) (diff)

This ticket was mentioned in PR #3140 on WordPress/wordpress-develop by Tabrisrp.


9 months ago
#2

  • Keywords has-patch added

Check for non-empty array key 1 before using it with current_user_can() to avoid PHP warning

Trac ticket: https://core.trac.wordpress.org/ticket/56254

#3 @desrosj
8 months ago

  • Keywords needs-unit-tests added
  • Version trunk deleted

Adding needs-unit-tests since some were requested in the PR.

Note: See TracTickets for help on using tickets.