You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if the 'bugsnag_filterfields' option isn't set, get_option('bugsnag_filterfields') will return false. this will make Bugsnag_Wordpress::filterFields return [""] (i.e. an array with one item containing an empty string (array(1) { [0]=> string(0) "" })). further down the line this array will make Error::cleanupObj believe that all values should be filtered, because https://github.com/bugsnag/bugsnag-php/blob/2.10/src/Bugsnag/Error.php#L386 will always be true (since strpos($key, "") will always return 0, and 0 is !== false).
my suggestion would be to rewrite https://github.com/bugsnag/bugsnag-wordpress/blob/master/bugsnag.php#L156 to if ($filter_fields === '' || $filter_fields === false) {
or maybe even better if (empty(trim($filter_fields ?? ''))) {
(to catch the case where the user has written just whitespace in the wp-admin (perhaps this line must be rewritten to support older php versions though). i could make a pr for this if you want?
pls note that setting 'bugsnag_filterfields' to "whatever\n" will yield the same problems since Bugsnag_Wordpress::filterFields then will return ["whatever",""] and then filter everything out based on the second item in the array. you should probably take a look at https://github.com/bugsnag/bugsnag-wordpress/blob/master/bugsnag.php#L160 and make sure it doesn't return any empty strings in the array.
Steps to reproduce
do nothing
trigger an error
see the error in the dashboard with all custom fields and request and cookies set to [FILTERED]
Environment
Bugsnag version: 1.6.1
PHP version: 8
Wordpress version: 6.0.2
The text was updated successfully, but these errors were encountered:
a possible workaround for this would of course be to set all options in the database upon install. since it's possible to set the other options via filters i think it's dangerous to assume that all users will submit the form on /wp-admin/options-general.php?page=bugsnag (and thus invoke Bugsnag_Wordpress::updateNetworkSettings setting the default values). this will of course not solve the problem with newlines as described above though.
Thanks for the report and workaround @fiskhandlarn !
This issue was resolved via a support ticket, but for the benefit of future travellers: it should be possible to work around the issue by setting the option to ""
it was me who filed the support ticket, and the issue still persists in the current version of this plugin, although i got great help by the support staff. :)
Describe the bug
if the 'bugsnag_filterfields' option isn't set,
get_option('bugsnag_filterfields')
will returnfalse
. this will makeBugsnag_Wordpress::filterFields
return[""]
(i.e. an array with one item containing an empty string (array(1) { [0]=> string(0) "" }
)). further down the line this array will makeError::cleanupObj
believe that all values should be filtered, because https://github.com/bugsnag/bugsnag-php/blob/2.10/src/Bugsnag/Error.php#L386 will always be true (sincestrpos($key, "")
will always return 0, and 0 is !==false
).my suggestion would be to rewrite https://github.com/bugsnag/bugsnag-wordpress/blob/master/bugsnag.php#L156 to
if ($filter_fields === '' || $filter_fields === false) {
or maybe even better
if (empty(trim($filter_fields ?? ''))) {
(to catch the case where the user has written just whitespace in the wp-admin (perhaps this line must be rewritten to support older php versions though). i could make a pr for this if you want?
pls note that setting 'bugsnag_filterfields' to
"whatever\n"
will yield the same problems sinceBugsnag_Wordpress::filterFields
then will return["whatever",""]
and then filter everything out based on the second item in the array. you should probably take a look at https://github.com/bugsnag/bugsnag-wordpress/blob/master/bugsnag.php#L160 and make sure it doesn't return any empty strings in the array.Steps to reproduce
[FILTERED]
Environment
The text was updated successfully, but these errors were encountered: