I am using the rollbar_plugin_settings filter to set check_ignore and 'person_fn', which I set to closures. However, this causes the library to throw a fatal error while it is building the PHP config. It's easily replicated by doing this:
add_filter('rollbar_plugin_settings', 'adjust_rollbar_php_settings');
function adjust_rollbar_php_settings(array $settings)
{
$settings['check_ignore'] = function () {
//
};
return $settings;
}
This results in this error:
Fatal error: Uncaught Error: Call to undefined method Closure::__set_state() in /rollbar/src/Plugin.php(326) : eval()'d code on line 1
This is the code block that's causing the error: (it is in \Rollbar\Wordpress\Plugin::buildPHPConfig())
I am using the
rollbar_plugin_settings
filter to setcheck_ignore
and 'person_fn', which I set to closures. However, this causes the library to throw a fatal error while it is building the PHP config. It's easily replicated by doing this:This results in this error:
This is the code block that's causing the error: (it is in
\Rollbar\Wordpress\Plugin::buildPHPConfig()
)The problem is being caused by the usage of
var_export()
because of the way that it handles closures:This is fixed by checking if
$config[$setting]
is NOT aClosure
:I confirmed that this fixes the issue by doing the following:
I then triggered an error and the closure was called:
I will submit a PR with the change for you to review. Thanks!