#58016 closed defect (bug) (invalid)
Plugin try to access an empty array at makewebbetter-hubspot-for-woocommerce/includes/class-hubwoodatasync.php 438
Reported by: | anhduc.bkhn | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Plugins | Keywords: | |
Focuses: | Cc: |
Description
My env:
- WP: 6.1
- MWB HubSpot for WooCommerce: 1.4.5
Plugin try to access the role of an user, but in some case, role is an empty array.
How to fix:
<?php // File makewebbetter-hubspot-for-woocommerce/includes/class-hubwoodatasync.php line 348 $user_data = get_user_by( 'email', $email ); $role = $user_data->roles[0];
We should check if role is empty or not before access
<?php $user_data = get_user_by( 'email', $email ); if (empty($user_data->roles)) { continue; } $role = $user_data->roles[0];
Change History (2)
Note: See
TracTickets for help on using
tickets.
Hi @anhducbkhn, welcome to Trac!
Trac is for the development of the WordPress Core software. It looks like you meant to report an issue and recommend a change in a plugin.
Please head on over to the MWB HubSpot for WooCommerce support forum to report this to the plugin's authors.
As this issue is not related to WordPress Core development, I'll close this ticket as
invalid
.