Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#54005 closed defect (bug) (worksforme)

Get warning error of "Undefined array key 0" after upgrading to PHP 8.0.9

Reported by: moazzamgodil's profile moazzamgodil Owned by:
Milestone: Priority: normal
Severity: normal Version: 5.8
Component: Plugins Keywords: php8 reporter-feedback
Focuses: Cc:

Description

Get warning errors on my plugin after upgrading to PHP 8.0.9. When calling the action of admin_notice, its return errors are given below:

Warning: Undefined array key 0 in C:\xampp\htdocs\wordpress\wp-includes\plugin.php on line 947
Warning: Undefined array key 0 in C:\xampp\htdocs\wordpress\wp-includes\plugin.php on line 950"

How do I fix this error? Thanks

Change History (8)

#1 @Hareesh Pillai
4 years ago

  • Keywords reporter-feedback added

Hi @moazzamgodil
Welcome to WordPress Trac. Thanks for creating the ticket.

To understand the issue better and debug, can you confirm if you are facing it after deactivating all the plugins and activating a bundled theme, say Twenty Twenty One?

#2 @moazzamgodil
4 years ago

Yes exactly. Before creating the ticket, I have already deactivated all the installed plugins and also using the same Twenty Twenty One theme.

#3 follow-up: @Hareesh Pillai
4 years ago

Thanks for the confirmation.
How are you calling admin_notice? In your theme's functions file? Can you share the code?

#4 @SergeyBiryukov
4 years ago

  • Keywords php8 added

#5 in reply to: ↑ 3 @moazzamgodil
4 years ago

Replying to Hareesh Pillai:

Thanks for the confirmation.
How are you calling admin_notice? In your theme's functions file? Can you share the code?

My issue has been resolved after I replaced add_action with do_action. Before the update, the admin_notice with add_action was working fine. Anyways thanks a lot.

#6 @jrf
4 years ago

  • Severity changed from critical to normal


#7 @moazzamgodil
4 years ago

  • Resolution set to worksforme
  • Status changed from new to closed

#8 @hellofromTonya
4 years ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.