Request code change / update to fix – Fatal error: Call to undefined function
-
Hi, first off I love your plugin ( should be part of the wordpress core functionality ).
I am a fairly experienced PHP developer and use this plugin on a site that uses a highly customized backed, but still includes the wp_head() and wp_footer() to theme the site, and provide some basic WordPress support, such as the menu and hence this plugin.
Normally this would probably not cause as big an issue but because we also use OptimizePress on the front end I am not able to add code to the functions.php file ( because when they do updates it gets replaced ).
That situation leaves me with some custom functions that are used by this plugin that I cannot easily add to the front end ( short of creating a separate plugin for them ).
So now to the root of the problem, the eval() call that processes custom functions currently does not check that those functions actually exist before calling them, granted in some cases it would be better to allow the error to happen, so it’s visible to the site owner. So it might be better to do this as an option or something like having a debugging mode that could be turned on and off .. etc.
I leave that to your discretion, but thought I would mention the issue and a possible fix for it.
on line 97 of init.php change
eval( ‘$visible = ‘ . $logic . ‘;’ );
to
$function = preg_replace(‘/\(.*\)$/’, ”, $logic);
if(function_exists($function)){
eval( ‘$visible = ‘ . $logic . ‘;’ );
}The regx just strips out the arguments ( so function exists will work properly ).
Thanks,
Thanks,
https://www.ads-software.com/plugins/menu-items-visibility-control/
- The topic ‘Request code change / update to fix – Fatal error: Call to undefined function’ is closed to new replies.