WordPress.org

Make WordPress Core

Opened 3 months ago

Closed 3 months ago

Last modified 3 months ago

#54005 closed defect (bug) (worksforme)

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

Reported by: 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
3 months 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
3 months 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
3 months ago

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

#4 @SergeyBiryukov
3 months ago

  • Keywords php8 added

#5 in reply to: ↑ 3 @moazzamgodil
3 months 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
3 months ago

  • Severity changed from critical to normal


#7 @moazzamgodil
3 months ago

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

#8 @hellofromTonya
3 months ago

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