trustpilot / plugin-magento2

Magento 2 plugin for sending invitation data to Trustpilot
MIT License
10 stars 27 forks source link

max length bug core_config_data #102

Open EFvS opened 1 year ago

EFvS commented 1 year ago

In the system.log file, I see the following error:

[2023-08-02T18:16:34.803839+00:00] main.ERROR: {"error":"Attempt to assign property \"B00125009\" on null","description":"Unable to handle response from invitations API","platform":"Magento2","version":"2.6.580","method":"handleSingleResponse","variables":{"storeId":1}} [] []

When I navigate to "Stores > Configuration > Trustpilot > General" I encounter the following exception:

1 exception(s): Exception #0 (Exception): Warning: foreach() argument must be of type array|object, null given in /var/www/src/vendor/trustpilot/module-reviews/Helper/PastOrders.php on line 147 Exception 
#0 (Exception): Warning: foreach() argument must be of type array|object, null given in /var/www/src/vendor/trustpilot/module-reviews/Helper/PastOrders.php on line 147 <pre>
#1 Trustpilot\Reviews\Helper\PastOrders->getPastOrdersInfo() called at [vendor/trustpilot/module-reviews/Block/System/Config/Admin.php:66] 
#2 Trustpilot\Reviews\Block\System\Config\Admin->getPastOrdersInfo()

This issue arises because the value for trustpilot/trustpilot_general_group/failed_orders is stored in core_config_data and the value exceeds the limit of a text field. The maximum value for a text field in MySQL is 65535 (2^16 - 1) characters.

A more effective solution would involve saving the value in a new table using mediumtext or longtext data types, which can accommodate larger amounts of text.

Can you please fix this?

pixiejohn commented 1 year ago

This is also a problem for one of our clients sites. Ive had to fix the truncated json data just so we can load the config page again. This has obviously resulted in data loss and i suppose its going to happen again in the future.

Please can someone have a look at this with some urgency?

stefanskotte commented 11 months ago

This module is pretty much a trainwreck. Installed on Magento 2.4.5-p1, just times out when loading the website/storeview scoped settings page.

I also find the whole approach half-assed by just including iframes from trustpilot's own system directly into the magento backend.

Will advice my customer to skip this completely. The observer that gets hit when saving (any order - not checking if the module is enabled) is also deprecated and generally discouraged to use.