Fatal error due to non-existent value
-
On a multisite we run the plugin Network Media Library by John Blackbourn, Dominik Schilling, Frank Bültge which was running fine til I installed your plugin. After that I got a fatal error.
“Network Media Library is a plugin for WordPress Multisite which provides a central media library that’s shared across all sites on the Multisite network.”I looked into the debug.log and got the following messages:
`[17-Aug-2021 08:06:56 UTC] PHP Notice: Undefined index: capability in /wp-content/plugins/all-in-one-seo-pack/app/Common/Admin/Admin.php on line 632
[17-Aug-2021 08:06:56 UTC] PHP Fatal error: Uncaught TypeError: Argument 2 passed to Network_Media_Library\allow_media_library_access() must be of the type string, null given, called in /wp-includes/class-wp-hook.php on line 303 and defined in /wp-content/plugins/network-media-library-master/network-media-library.php:348
Stack trace:
#0 /wp-includes/class-wp-hook.php(303): Network_Media_Library\allow_media_library_access(Array, NULL, 1, Array)
#1 /wp-includes/plugin.php(189): WP_Hook->apply_filters(Array, Array)
#2 /wp-includes/capabilities.php(658): apply_filters(‘map_meta_cap’, Array, NULL, 1, Array)
#3 /wp-includes/class-wp-user.php(755): map_meta_cap(NULL, 1)
#4 /wp-includes/capabilities.php(801): WP_User->has_cap(NULL)
#5 /wp-includes/capabilities.php(693): user_can(Object(WP_User), NULL)
#6 /wp-admin/includes/plugin.php(1395): current_user_can(NULL)
#7 /home/www/web94/h in /wp-content/plugins/network-media-library-master/network-media-library.php on line 348
[17-Aug-2021 08:07:06 UTC] PHP Notice: Undefined index: capability in /wp-content/plugins/all-in-one-seo-pack/app/Common/Admin/Admin.php on line 632
[17-Aug-2021 08:07:06 UTC] PHP Fatal error: Uncaught TypeError: Argument 2 passed to Network_Media_Library\allow_media_library_access() must be of the type string, null given, called in /wp-includes/class-wp-hook.php on line 303 and defined in /wp-content/plugins/network-media-library-master/network-media-library.php:348
Stack trace:
#0 /wp-includes/class-wp-hook.php(303): Network_Media_Library\allow_media_library_access(Array, NULL, 1, Array)
#1 /wp-includes/plugin.php(189): WP_Hook->apply_filters(Array, Array)
#2 /wp-includes/capabilities.php(658): apply_filters(‘map_meta_cap’, Array, NULL, 1, Array)
#3 /wp-includes/class-wp-user.php(755): map_meta_cap(NULL, 1)
#4 /wp-includes/capabilities.php(801): WP_User->has_cap(NULL)
#5 /wp-includes/capabilities.php(693): user_can(Object(WP_User), NULL)
#6 /wp-admin/includes/plugin.php(1395): current_user_can(NULL)
#7 /home/www/web94/h in /wp-content/plugins/network-media-library-master/network-media-library.php on line 348`I investigate this and found out the error was thrown because $page[‘capability’] isn’t set and it’s value is therefore null.
I’ve change line 632 of /wp-content/plugins/all-in-one-seo-pack/app/Common/Admin/Admin.php to (string)$page[‘capability’] so that the data type now is correct and the error is gone.
So it would be nice if you check it and maybe add my solution into your plugin codebase so that I don’t have to add it after each update.
- The topic ‘Fatal error due to non-existent value’ is closed to new replies.