0

I have a website (Magento 2.4.2 + php7.4) which runs well,then I upgraded it to (Magento 2.4.7-beta1 + php8.2) via composer, upgradtion succeeded,if the 3rd party app "Amasty" is removed from the project,"sudo php bin/magento setup:di:compile" ran well too; if the 3rd party app "Amasty" is kept on the project, "sudo php bin/magento setup:di:compile" got error: Compilation was started. Repositories code generation... 1/9 [===>------------------------] 11% < 1 sec 125.0 MiBPHP Fatal error: Cannot declare class Amasty\AdminActionsLog\lib\HtmlNode, because the name is already in use in /var/www/html/mydomain.com/app/code/Amasty/AdminActionsLog/lib/HtmlNode.php on line 6, note : line 6 content is "class HtmlNode {" below are 3 files of php partial source code among Amasty: (1) app\code\Amasty\AdminActionsLog\lib\HtmlNode.php

<?php
namespace Amasty\AdminActionsLog\lib;
include_once 'HtmlNodeText.php';
include_once 'HtmlSelector.php';
class HtmlNode {
    const NODE_ELEMENT = 0;

(2) app\code\Amasty\AdminActionsLog\lib\HtmlNodeCdata.php

<?php
namespace Amasty\AdminActionsLog\lib;
class HtmlNodeCdata extends HtmlNode {

(3) app\code\Amasty\AdminActionsLog\lib\HtmlNodeComment.php

<?php
namespace Amasty\AdminActionsLog\lib;
class HtmlNodeComment extends HtmlNode {

my question is : why "sudo php bin/magento setup:di:compile" ran well in php7.4 but got errors in php8.2 and how to fix it ?

thank you in advance.

roapp
  • 530
  • 6
  • 17

1 Answers1

0

You have upgraded to the latest Magento, which is in beta. Amasty packages do not have support for this version. There is a change from PHP to a newer version, a lot of things may be outdated, some of the objects in Magento also get updates and it is required that you update the Amasty packages to a version that is compatible firstly with PHP8.2 and secondly with Magento in a newer version.

There is not much point in fixing this. I would ask the question in the other direction. Why do you want Magento in beta instead of choosing a stable version to which 3rd party packages may have already been updated?

  • thank you for your help, I've downgraded Magento2.4.7-beta1 to Magento2.4.6 as per your suggestion,the current Amasty versions are below, do you know what are the Aasty versions which matches Magento2.4.6 ? ShopbyPage 1.0.1, 2.13.3, Shiprestriction 1.5.3, 2.3.0, 1.0.0 1.12.14 AdminActionsLog 1.12.14, 1.5.5, ShopbyBrand 2.15.0, 1.10.8 GroupedOptions Conditions 1.4.7 Shopby 1.0.1, fix1.0.0 Mage24Fix 1.9.4 Shopby 1.12.17, 2.15.0, 2.12.2, 2.12.1, 2.7.11 ShopbySeo 1.0.1, 2.15.0, CommonRules 1.4.7, 1.3.4 – Felix Chen Jul 25 '23 at 13:33