PHP Fatal error: Traits cannot have constants in web/modules/contrib/re_mgr/src/Entity/EntityBaseDataTrait.php on line 13

Created on 29 February 2024, 10 months ago
Updated 18 March 2024, 9 months ago

PHP Fatal error: Traits cannot have constants in web/modules/contrib/re_mgr/src/Entity/EntityBaseDataTrait.php on line 13

In the latest version of drupal 10.2 I have installed the re_mgr module using composer
composer require 'drupal/re_mgr:^1.0'

I have enabled all re_mgr module and submodules through UI , I don't see anything on the screen , complete white screen.

Then I have cleared cache using drush. Then I saw above errow.

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇮🇳India FlutterStack

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @FlutterStack
  • Status changed to Needs review 10 months ago
  • 🇮🇳India sarwan_verma

    Hi @FlutterStack,

    I have fixed this issue "PHP Fatal error: Traits cannot have constants in web/modules/contrib/re_mgr/src/Entity/EntityBaseDataTrait.php on line 13" and also attached patch,
    please review and verify.

  • 🇮🇳India FlutterStack

    Error: Undefined constant Drupal\re_mgr_visualization\Service\CoordinatesFieldService::ENTITY_LIST in Drupal\re_mgr_visualization\Service\CoordinatesFieldService->__construct() (line 67 of modules/contrib/re_mgr/modules/visualization/src/Service/CoordinatesFieldService.php).

  • Assigned to Mattixonix
  • Status changed to Fixed 10 months ago
  • Hi @FlutterStack, thank you for reporting that issue. Problem happens on PHP lower than 8.2. My bad because i didn't tested lower PHP versions after adding trait to optimize code.

    Thanks @sarwan_verma for your patch, however it's not working properly. By changing constants to static variables and changing their names You solved global PHP problem, but module will not work after that. With changing variables names you should also change each place where they were used in code. Despite that i'll grand you credit for good idea ;)

    I've added new release to module here https://www.drupal.org/project/re_mgr/releases/1.0.6 . It's fix this problem and also few smaller bugs.

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024