Fix connection array merge error #3355
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #2411
Additional context:
Changes proposed in this Pull Request:
This PR fixes a fatal error issue that is happening to some merchants. When trying to merge the existing Stripe settings with the updated version, some merchants are getting an error like:
or
This means that
get_optiononincludes/connect/class-wc-stripe-connect.php#153returns an invalid value.I could not reproduce this issue using PHP 8.1, 8.2, or 8.3 as merchants reported. So, for extra safety, the fix consists of checking if the returning value is a valid array.
Testing instructions
A code review should be enough since no way to reproduce this issue correctly has been found yet. Check if the change looks safe enough for you.
You can also make some tests by hardcoding the value of
$current_options(includes/connect/class-wc-stripe-connect.php#153) to different types and connect your Stripe account.changelog.txtandreadme.txt(or does not apply)Post merge
cc @diegocurbelo @c-shultz