Causing 500 errors in Admin after last update
-
I have had to disable the plugin on my site, as the latest update causes 500 errors when I try to view the plugin page or the menus page in the admin. I disabled all other plugins, so it wasn’t a plugin conflict. It may be a theme conflict, as I didn’t test the theme. I suppose I will go and do that now. However, not sure how a conflict in the theme could cause 500 errors like that. I can see causing the plugin to not work, but 500 errors seems a bit extreme.
What got changed in the last update? Because it was working just find before that.
-
The thing that changed was the admin notice, which is set to display a more specific error message on plugins and menus page so that must be the issue. You can see all the changes here:
https://github.com/helgatheviking/Nav-Menu-Roles/commits/masterCan you enable the your debug log and post your log (at least the recent/relevant parts)? I did not experience this issue and can’t reproduce it myself so need to see yours.
https://codex.ww.wp.xz.cn/WP_DEBUG#WP_DEBUG_LOG_and_WP_DEBUG_DISPLAY
Turns out it was some kind of conflict in my theme. Seems I was able to write in a fix, but the new update renders that fix useless. I also get the following error notice when I have Visual Composer enabled:
Nav Menu Roles has detected a possible conflict with the following functions or classes: W, k. Please direct the author of the conflicting theme or plugin to the FAQ for a solution.I’m sure you are already aware of that one though. My theme uses MegaMenu with a custom walker, so I’m sure the problems are stemming from all of that.
Seems I was able to write in a fix, but the new update renders that fix useless.
I don’t know what kind of fix you are referring to.
It is possible (and likely) to have conflicts with themes, because plenty of themes think they should build plugin functionality right into their theme… and adding mega menu is a common culprit. It is harder for me to reach out to a million theme authors than a handful of plugin authors with known conflicts.
That error message is intentional, though I’m rethinking it based on the number of support threads it has generated. Some plugins/themes have enacted the workaround described in the FAQ and if you aren’t having any problems you can simply dismiss the notice.
OK. So here is the error that I get immediately after I update. Note: I was at 1.7.3 before, now after update it says 1.7.7.
Fatal error: Uncaught exception ‘ReflectionException’ with message ‘Function Walker_Nav_Menu() does not exist’ in /home/midwetu7/public_html/hsc-sb/wp-content/plugins/nav-menu-roles/nav-menu-roles.php:541 Stack trace: #0 /home/midwetu7/public_html/hsc-sb/wp-content/plugins/nav-menu-roles/nav-menu-roles.php(541): ReflectionFunction->__construct(‘Walker_Nav_Menu’) #1 /home/midwetu7/public_html/hsc-sb/wp-content/plugins/nav-menu-roles/nav-menu-roles.php(208): Nav_Menu_Roles::list_hooks(‘wp_edit_nav_men…’) #2 [internal function]: Nav_Menu_Roles->admin_notice(”) #3 /home/midwetu7/public_html/hsc-sb/wp-includes/plugin.php(525): call_user_func_array(Array, Array) #4 /home/midwetu7/public_html/hsc-sb/wp-admin/admin-header.php(250): do_action(‘admin_notices’) #5 /home/midwetu7/public_html/hsc-sb/wp-admin/plugins.php(438): require_once(‘/home/midwetu7/…’) #6 {main} thrown in /home/midwetu7/public_html/hsc-sb/wp-content/plugins/nav-menu-roles/nav-menu-roles.php on line 541
This is on my test site. Also note that the word around I was referring to was the method described in the FAQ for the mega menu (Workaround #1 I suppose). So I patched my theme as described to get it working. Not sure if this is related to that or not.
Thanks for posting the log… that gives me a lot more info to go on and I’ll try to fix it as soon as I can.
In the mean time you could try removing the admin notice:
function nmr_disable_notice(){ if( function_exists( 'Nav_Menu_Roles' ) ){ $nmr = Nav_Menu_Roles(); remove_action( 'admin_notices', array( $nmr, 'admin_notice' ) ); } } add_action( 'admin_init', 'nmr_disable_notice' );If you’ve patched your theme, that should still be good to go once I resolve this notice problem.
I’m debating trying to fix this error or removing the admin notice altogether, since it hasn’t reduced my support load at all. 🙂
Tried using the contact form on your website, but it doesn’t seem to be working. I click submit and nothing happens? Just give me your email address?
That form is going to be the death of me. Anyway, I think I was able to reproduce the error and as far as I can tell it only occurred when a plugin/theme was filtering the
wp_nav_with a function that doesn’t actually exist.I’ve added some
try/catchstatements to the reflection class stuff so that fatal errors should be avoided.If you would like to you can test the new version here:
https://github.com/helgatheviking/Nav-Menu-Roles/blob/notice_errors/nav-menu-roles.phpI’d love another set of eyes before I push it live.
I will implement and see how it goes here after I get back from lunch break. Thanks so much for looking into that for me. You seem to be a very good independent developer with great support.
Did you get a chance to test this?
Not yet. On my agenda for this morning.
I still got this error:
Fatal error: Uncaught exception ‘ReflectionException’ with message ‘Function Walker_Nav_Menu() does not exist’ in /home/midwetu7/public_html/hsc-sb/wp-content/plugins/nav-menu-roles/nav-menu-roles.php:437 Stack trace: #0 /home/midwetu7/public_html/hsc-sb/wp-content/plugins/nav-menu-roles/nav-menu-roles.php(437): ReflectionFunction->__construct(‘Walker_Nav_Menu’) #1 /home/midwetu7/public_html/hsc-sb/wp-content/plugins/nav-menu-roles/nav-menu-roles.php(163): Nav_Menu_Roles::list_hooks(‘wp_edit_nav_men…’) #2 [internal function]: Nav_Menu_Roles->admin_notice(”) #3 /home/midwetu7/public_html/hsc-sb/wp-includes/plugin.php(525): call_user_func_array(Array, Array) #4 /home/midwetu7/public_html/hsc-sb/wp-admin/admin-header.php(250): do_action(‘admin_notices’) #5 /home/midwetu7/public_html/hsc-sb/wp-admin/plugins.php(438): require_once(‘/home/midwetu7/…’) #6 {main} thrown in /home/midwetu7/public_html/hsc-sb/wp-content/plugins/nav-menu-roles/nav-menu-roles.php on line 437WHAT!? there’s no way a fatal error should be happening now with the try/catch. you’re sure you’re using the new branch?
exasperated sigh. i hate this plugin so much sometimes.
i think i’ve officially decided to remove the notice. stay tuned for that.
I just copied and pasted the code from the link you provided into the nav-menu-roles.php file. As long as the link that you provided is correct, then that was tested with the correct code.
1.7.8 removes the admin notices entirely. They’ve caused far more trouble than I ever anticipated.
The topic ‘Causing 500 errors in Admin after last update’ is closed to new replies.