tawk / tawk-magento-2

Tawk.to live chat plugin for Magento 2
12 stars 22 forks source link

[fix] Compatibility among Magento 2 versions #38

Closed tuyennn closed 1 month ago

tuyennn commented 2 months ago

Error log while upgrading version on Magento >= 2.4.4

There is an error in /vendor/tawk/widget/Setup/UpgradeData.php at line: 97
Class "Zend_Uri_Http" not found#0 /vendor/tawk/widget/Setup/UpgradeData.php(75): Tawk\Widget\Setup\UpgradeData->getStoreHost()
#1 /vendor/tawk/widget/Setup/UpgradeData.php(54): Tawk\Widget\Setup\UpgradeData->versionUpdate160()

Apparently, this was not completely support Magento >= 2.4.4 as https://github.com/tawk/tawk-magento-2/blob/v1.6.0/Setup/UpgradeData.php#L97 Zend_Uri_Http was removed, in this case to make thing compatibility support Magento >= 2.4.4 and Magento < 2.4.4 consider to use: parse_url()

Or use Laminas\Uri\Http for support Magento >= 2.4.4 only

Fix https://github.com/tawk/tawk-magento-2/issues/37

gkopec commented 2 months ago

Will this be merged to master branch?

eug-L commented 1 month ago

Hi @tuyennn thanks for opening a PR, may I know how do you reproduce the error?

tuyennn commented 1 month ago

@eug-L this can be reproduced while running Magento >= 2.4.4 and perform upgrade tawk/widget < 1.6.0 to 1.6.0, happened every times while anyone tried to upgrade the Magento also update their modules accordingly

eug-L commented 1 month ago

@tuyennn I found that the error with Zend_Uri_Http is due to the dependency magento/zendframework1 being removed from Magento since 2.4.6. parse_url() does seem like a good alternative

I also managed to find this error, which you have fixed as well

Deprecated Functionality: preg_split(): Passing null to parameter #2 ($subject) of type string is deprecated in /bitnami/magento/vendor/tawk/widget/Setup/UpgradeData.php on line 119

Thank you for fixing these issues!

CLAassistant commented 1 month ago

CLA assistant check
All committers have signed the CLA.

eug-L commented 1 month ago

@tuyennn Before we can merge this PR, we kindly ask that you sign the CLA. This is to ensure we can safely use your code.