Page 1 of 1

Customizing Severity

Posted: 13 Oct 2023, 15:59
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?

Re: Customizing Severity

Posted: 13 Oct 2023, 17:03
by atrol
Which MantisBT version do you use?

Re: Customizing Severity

Posted: 13 Oct 2023, 19:14
by WWY
Duh! Sorry. 2.25.7

Re: Customizing Severity

Posted: 15 Oct 2023, 15:08
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.

Re: Customizing Severity

Posted: 16 Oct 2023, 13:13
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