[wp-trac] [WordPress Trac] #61962: Admin: remove_menu_page throws PHP warning when $menu is null (was: error.log - cant figure out issue with Google Search..)
WordPress Trac
noreply at wordpress.org
Fri Sep 6 00:08:27 UTC 2024
#61962: Admin: remove_menu_page throws PHP warning when $menu is null
-----------------------------------------+------------------------------
Reporter: xbigx | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Plugins | Version: 6.6.1
Severity: normal | Resolution:
Keywords: has-patch reporter-feedback | Focuses: administration
-----------------------------------------+------------------------------
Changes (by ironprogrammer):
* keywords: has-patch => has-patch reporter-feedback
Old description:
> {{{
> [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/
> }}}
New description:
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/
}}}
--
Comment:
Welcome to Trac, @xbigx, and thanks for the report! And thank you,
@narenin, for a proposed patch!
It would be really helpful if [https://make.wordpress.org/test/handbook
/test-reports/testing-instructions/ 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.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/61962#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list