Opened 3 months ago
Last modified 3 weeks ago
#61962 new defect (bug)
Admin: remove_menu_page throws PHP warning when $menu is null
Reported by: | xbigx | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | |
Component: | Plugins | Keywords: | has-patch reporter-feedback |
Focuses: | administration | Cc: |
Description (last modified by )
error.log:
[Thu Aug 29 21:48:07.078821 2024] [php:warn] [pid 16202] [client 172.69.58.130:44688] PHP Warning: foreach() argument must be of type array|object, null given in /var/www/example.com/shop.example.com/wp-admin/includes/plugin.php on line 1853, referer: https://shop.example.com/wp-admin/plugins.php?plugin_status=all&paged=1&s [Thu Aug 29 21:48:20.875148 2024] [php:warn] [pid 16197] [client 172.69.59.57:34548] PHP Warning: foreach() argument must be of type array|object, null given in /var/www/example.com/www.example.com/wp-admin/includes/plugin.php on line 1853, referer: https://example.com/wp-admin/ [Thu Aug 29 21:49:08.193887 2024] [php:warn] [pid 16191] [client 172.69.58.29:63630] PHP Warning: foreach() argument must be of type array|object, null given in /var/www/example.com/shop.example.com/wp-admin/includes/plugin.php on line 1853, referer: https://shop.example.com/wp-admin/index.php [Thu Aug 29 21:50:08.131920 2024] [php:warn] [pid 16388] [client 172.69.58.223:63418] PHP Warning: foreach() argument must be of type array|object, null given in /var/www/example.com/shop.example.com/wp-admin/includes/plugin.php on line 1853, referer: https://shop.example.com/wp-admin/plugins.php?plugin_status=all&paged=1&s [Thu Aug 29 21:50:21.769929 2024] [php:warn] [pid 16193] [client 172.69.58.231:25962] PHP Warning: foreach() argument must be of type array|object, null given in /var/www/example.com/www.example.com/wp-admin/includes/plugin.php on line 1853, referer: https://example.com/wp-admin/ [Thu Aug 29 21:51:08.308475 2024] [php:warn] [pid 16384] [client 172.69.58.183:64764] PHP Warning: foreach() argument must be of type array|object, null given in /var/www/example.com/shop.example.com/wp-admin/includes/plugin.php on line 1853, referer: https://shop.example.com/wp-admin/index.php [Thu Aug 29 21:52:22.795278 2024] [php:warn] [pid 16202] [client 172.69.58.24:28566] PHP Warning: foreach() argument must be of type array|object, null given in /var/www/example.com/www.example.com/wp-admin/includes/plugin.php on line 1853, referer: https://example.com/wp-admin/ [Thu Aug 29 21:53:05.970841 2024] [php:warn] [pid 16197] [client 172.69.58.163:36022] PHP Warning: foreach() argument must be of type array|object, null given in /var/www/example.com/shop.example.com/wp-admin/includes/plugin.php on line 1853, referer: https://shop.example.com/wp-admin/index.php [Thu Aug 29 21:53:08.902748 2024] [php:warn] [pid 16197] [client 172.69.58.163:36022] PHP Warning: foreach() argument must be of type array|object, null given in /var/www/example.com/shop.example.com/wp-admin/includes/plugin.php on line 1853, referer: https://shop.example.com/wp-admin/plugins.php?plugin_status=all&paged=1&s [Thu Aug 29 21:53:23.836918 2024] [php:warn] [pid 16191] [client 172.69.59.91:51414] PHP Warning: foreach() argument must be of type array|object, null given in /var/www/example.com/www.example.com/wp-admin/includes/plugin.php on line 1853, referer: https://example.com/wp-admin/
Change History (6)
This ticket was mentioned in PR #7273 on WordPress/wordpress-develop by @narenin.
3 months ago
#1
- Keywords has-patch added; needs-patch removed
#2
@
3 months ago
Hi @xbigx
Welcome to the Core Trac!
This warning is coming because null is passed to foreach. I have created the PR with patch for the same.
Thanks for the detailed information.
#3
@
3 months ago
- Description modified (diff)
- Keywords reporter-feedback added
- Summary changed from error.log - cant figure out issue with Google Search.. to Admin: remove_menu_page throws PHP warning when $menu is null
Welcome to Trac, @xbigx, and thanks for the report! And thank you, @narenin, for a proposed patch!
It would be really helpful if testing instructions were provided so that other contributors could attempt to reproduce the error, and then validate the patch. I'm not able to reproduce this error using a vanilla install of WordPress.
I'm marking this ticket with reporter-feedback
to request additional information from @xbigx, such as environment or plugin information that may point to how remove_menu_page
is being called. For instance, if it's being called before the $menu
global has been initialized (like in the plugins_loaded
hook), then it may point toward a different problem.
I've also updated the ticket title for clarity.
#4
@
3 months ago
- Version 6.6.1 deleted
I too am unable to reproduce this reported issue.
Also, not seeing any changes made in 6.6.1 release that might contribute the reported issue. Removing it as the Version
.
Trac ticket: https://core.trac.wordpress.org/ticket/61962