Customizing Severity

Post about your customizations to share with others.

Moderators: Developer, Contributor

Post Reply
WWY
Posts: 15
Joined: 13 Oct 2023, 15:43

Customizing Severity

Post by WWY »

Testing PHP upgrade from 7.3 (on the hosting system) to 8.0 (on local Windows system, XAMPP) using the same Mantis source code in both.

On the PHP v7 setup I have entered new strings for severities in config/config_inc.php

Code: Select all

$g_severity_enum_string = '50:minor,60:medium,70:major';
$g_severity_multipliers = array(
   MINOR   => 5,
   MEDIUM  => 6,
   MAJOR   => 10
);
Everything seems to work fine. No other files updated. I place the same into my PHP8 setup and in login get
Uncaught Error: Undefined constant "MEDIUM"

I then update config\custom_constants_inc.php and get
Constant MINOR already defined in [my install location]\mantisbt\config\custom_constants_inc.php

The error seems accurate except I thought the purpose of custom_constants_inc.php was to override core\constant_inc.php which it appears not to be doing. I have also followed the instructions given here - viewtopic.php?p=68343#p68343 and get the same results. Is there a change in PHP8?

Any thoughts?
atrol
Site Admin
Posts: 8378
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Customizing Severity

Post by atrol »

Which MantisBT version do you use?
Please use Search before posting and read the Manual
WWY
Posts: 15
Joined: 13 Oct 2023, 15:43

Re: Customizing Severity

Post by WWY »

Duh! Sorry. 2.25.7
dregad
Developer
Posts: 76
Joined: 26 Jul 2010, 14:24

Re: Customizing Severity

Post by dregad »

In PHP, constants can't be redefined (otherwise they would, by definition, not be constants).

MINOR is a standard constant defined in constant_inc.php. If you define it again in your custom constants file it creates a conflict hence the error you get.

Either use the standard value for MINOR (50) or use a different name.
WWY
Posts: 15
Joined: 13 Oct 2023, 15:43

Re: Customizing Severity

Post by WWY »

Thank you for the response. While I already understood all of that, it was taking a step back, getting my head around customization, and the simple clarity of the last reply that brought it all into focus. And yeah, I got it to work. :D
Post Reply