-
Notifications
You must be signed in to change notification settings - Fork 18
Description
Module Version: 2.1.27
Magento Version: 2.4.6-p6
Issue Description:
When attempting to connect the module, an error is displayed:
Error :- “A technical problem with the server created an error. Try again to continue what you were doing. If the problem persists, try again later.”
In the shop exception.log, the following error appears:
TypeError: ActiveCampaign\Core\Helper\Data::getStoreLogo(): Argument#1 ($scopeCode) must be of type ?string, int given, called in /vendor/activecampaign/module-integration/Core/Controller/Adminhtml/System/Config/Connect.php on line 236 and defined in /vendor/activecampaign/module-integration/Core/Helper/Data.php:121
Screenshot-1: Error
Steps to Reproduce:
- Take a shop.
- Install “activecampaign/module-integration” module and run setup command.
- In the Admin -> Store -> Configuration -> ActiveCampaign -> Configuration -> General -> API key
- Enter the API key and click the Connect button.
- The error appears.
Expected Results:
The connection should be established successfully without any errors.
Actual Results:
An error is thrown after clicking the Connect button.
Additional Information:-
While debugging, I found that in the file vendor/activecampaign/module-integration/Core/Helper/ Data.php there is a function called getStoreLogo(). As shown in Screenshot-2, the $scopeCode parameter defined as a nullable string (?string). This means when $scopeCode receives its value from the configuration, it can only return a string or null. However, in the default Magento implementation, $scopeCode can return an integer, a string, or null.
Also, as you can see in ScreenShot-3 the function getStoreLogo() is called from the file
vendor/activecampaign/module-integration/Core/Controller/Adminhtml/System/Config/Connect.php
within the CurlRequestData() method, where a store ID (integer) is passed instead of a string.Since the method strictly expects a string or null, passing an integer results in a TypeError.
Screenshot-2 :- Code Reference
Screenshot-3 :- Code Reference
Suggested Solution :-
The $scopeCode parameter should not be strictly limited to ?string. It should allow int, string, or null.