Skip to content

Commit

Permalink
Fix: Fatal error when Klaviyo querystring was defined but empty
Browse files Browse the repository at this point in the history
```[04-Aug-2022 19:55:09 UTC] PHP Fatal error:  Uncaught BrianHenryIE\WP_Autologin_URLs\Klaviyo\ApiException: [400] Client error: `POST https://a.klaviyo.com/api/v2/people/exchange?api_key=pk_fba29ec017da114f45d68cbab138bc3e31` resulted in a `400 Bad Request` response:
{"detail":["Missing exchange_id"]}
 in /path/to/wp-content/plugins/bh-wp-autologin-urls/vendor-prefixed/klaviyo/sdk/lib/API/ProfilesApi.php:159
Stack trace:
#0 /path/to/wp-content/plugins/bh-wp-autologin-urls/vendor-prefixed/klaviyo/sdk/lib/API/ProfilesApi.php(135): BrianHenryIE\WP_Autologin_URLs\Klaviyo\API\ProfilesApi->exchangeWithHttpInfo(Array)
#1 /path/to/wp-content/plugins/bh-wp-autologin-urls/vendor-prefixed/klaviyo/sdk/lib/Subclient.php(57): BrianHenryIE\WP_Autologin_URLs\Klaviyo\API\ProfilesApi->exchange(Array)
#2 /path/to/wp-content/plugins/bh-wp-autologin-urls/src/API/Integrations/class-klaviyo.php(120): BrianHenryIE\WP_Autologin_URLs\Klaviyo\Subclient->__call('exchange', Array)
#3 /path/to/wp-content/plugins/bh-wp-autologin-urls/src/API/Integrations/class-klaviyo.php(88): BrianHenryIE\WP_Autologin_URLs\API\Integrations\Klaviyo->get_user_data('')
#4 /path/to/wp-content/plugins/bh-wp-autologin-urls/src/WP_Includes/class-login.php(84): BrianHenryIE\WP_Autologin_URLs\API\Integrations\Klaviyo->get_wp_user_array()
#5 /path/to/wp-includes/class-wp-hook.php(307): BrianHenryIE\WP_Autologin_URLs\WP_Includes\Login->process('')
#6 /path/to/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters(NULL, Array)
#7 /path/to/wp-includes/plugin.php(476): WP_Hook->do_action(Array)
#8 /path/to/wp-settings.php(461): do_action('plugins_loaded')
#9 /path/to/wp-config.php(95): require_once('/chroot/home/ab...')
#10 /path/to/wp-load.php(50): require_once('/chroot/home/ab...')
#11 /path/to/wp-blog-header.php(13): require_once('/chroot/home/ab...')
#12 /path/to/index.php(17): require('/chroot/home/ab...')
#13 {main}
  thrown in /path/to/wp-content/plugins/bh-wp-autologin-urls/vendor-prefixed/klaviyo/sdk/lib/API/ProfilesApi.php on line 159
```
  • Loading branch information
BrianHenryIE committed Aug 4, 2022
1 parent 9a41086 commit 3119a74
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/API/Integrations/class-klaviyo.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function __construct( Settings_Interface $settings, LoggerInterface $logg
* Determine is the querystring needed for this integration present.
*/
public function is_querystring_valid(): bool {
return isset( $_GET[ self::QUERYSTRING_PARAMETER_NAME ] );
return ! empty( $_GET[ self::QUERYSTRING_PARAMETER_NAME ] );
}

/**
Expand Down

0 comments on commit 3119a74

Please sign in to comment.