Closed codepuncher closed 3 years ago
The code that is called in the plugin is:
apply_filters( 'wp_sentry_options', $this->get_client()->getClient()->getOptions() );
And getOptions
has Options
as a return type, so it cannot be null
(getClient
could technically return null
but that would result in a method call on null
error stopping the application).
Do you have multiple wp_sentry_options
filters perhaps and forget to end the filters with return $options
? Because no return or just return;
will result in the value passed down the filters to be null
instead of the expected Options
object like you are seeing.
Edit: I have updated the README example to include the return $options;
to possibly prevent this in the future
Ah, yep. That might have been the issue; not returning the Options
object.
Thanks for updating the readme!
All good now.
I am having issues with using the
wp_sentry_options
filter. It seems that the 1st argument passed is alwaysnull
rather than\Sentry\Options
and as a result, the code I am writing is not being fired.I have made an MU Plugin to load the plugin sooner, as instructed by the readme. This is also where I've added additional filters.
I'm just trying to prevent some errors from plugins from being sent to Sentry, following this.
However, it seems that instead of an
Options
object being passed, it'snull
.Is there perhaps a bug or misuse of the filters?
Thanks
WP 5.8
wp-sentry-integration
4.5.0 PHP 7.4