View Issue Details

IDProjectCategoryView StatusLast Update
0036855mantisbtbugtrackerpublic2026-01-30 16:01
Reporterraspopov Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
OSWindows 
Product Version2.28.0 
Summary0036855: Application error on bug_relationship_graph.php page
Description

The following error is displayed when the bug_relationship_graph.php page is visited:

'Undefined array key "SystemRoot"' in '...\core\utility_api.php' line 277

This occurs in Windows when a web server does not load environment variables. For example, this happens with the built-in web server in PHP.

Additional Information

This is due to the following code:

$t_system_root = $_SERVER['SystemRoot'];

in the get_font_path() function.

TagsNo tags attached.

Relationships

related to 0036859 new Optimization of Graphviz calls 

Activities

raspopov

raspopov

2026-01-28 10:26

reporter   ~0070737

PR: https://github.com/mantisbt/mantisbt/pull/2173

It's interesting to note that the way the get_font_path() function is used to configure Graphviz utilities doesn't make sense on Windows, the utilities search for fonts in the Windows system font directory on their own.

dregad

dregad

2026-01-28 11:18

developer   ~0070738

the way the get_font_path() function is used to configure Graphviz utilities doesn't make sense on Windows, the utilities search for fonts in the Windows system font directory on their own.

Considering that this is really old code (2009-ish, MantisBT master 0c323ef6), before I even joined the project, and that I don't use Mantis on Windows myself, I have absolutely no idea why it was implemented like that...

Are you saying that on Windows it would be better not to set fontpath at all and let GraphViz do its thing with its default instead ?

raspopov

raspopov

2026-01-28 13:12

reporter   ~0070739

After doing some research, I found that the old version of Graphviz did not use the built-in fontconfig. It required the font folder to be specified explicitly.

Furthermore, the new version of Graphviz does not support the method used in MantisBT to set the user font directory via the "fontpath" configuration option (a separate fontconfig configuration file is required).

dregad

dregad

2026-01-29 06:23

developer   ~0070740

Not sure what you mean by old version, new version... Can you be more specific ?
Do we need to require a minimum version for Graphviz and/or change graphviz API?

raspopov

raspopov

2026-01-29 10:31

reporter   ~0070741

Last edited: 2026-01-30 15:48

Starting with version 2.14-2.40 (released in 2008), it was updated to use fontconfig. Prior to that, it relied on libgd to work with fonts.

I tried (under Process Monitor) configuring fonts on Windows the same way I would with fontconfig on Linux, but nothing worked. The only option seems to be installing the font the standard Windows way, either in C:\Windows\Fonts or a similar folder in the user profile. Fontconfig only searches for fonts in these locations and the registry. Therefore, the system_font_folder setting has no effect under Windows.

API changes are probably unnecessary, except for possibly adding a comment to the configuration (config_defaults_inc.php etc.).

dregad

dregad

2026-01-30 05:20

developer   ~0070749

Thanks for the clarification.

Indeed an update to documentation (config_defaults_inc.php / admin guide) seems the appropriate way to address this.

As a side note, I have no idea why $g_system_font_folder is documented in the Signup and Lost Password section, that makes absolutely no sense. I would suggest moving it to Bug Relationships / Relationship Graphs.

Interestingly, on my dev box (MacOS, GraphViz 14.1.1), I just realized that I had an invalid $g_system_font_folder set in config_inc.php (left over from the days I was developing under Linux), and it works flawlessly even so; it also works fine with an empty config, which is interesting considering that none of the paths checked by get_font_path() exist on this system.

I also tested on an Ubuntu server with GraphViz 2.43.0, where $g_system_font_folder is not set and get_font_path() resolves to /usr/share/fonts/truetype/. I also tried setting $g_system_font_folder to an invalid path, and in both cases the graphs are generated successfully.

So maybe $g_system_font_folder, get_font_path() and dependent code is no longer needed with recent versions of GraphViz. If that's indeed the case, we could remove the whole thing, and just document that GraphViz >= 2.14 (or whatever the actual version is, as I did not find a match for the one you referenced at https://www2.graphviz.org/Archive/stable/SOURCES/, 2.14 is from 2007, 2.40 from 2016)...

raspopov

raspopov

2026-01-30 16:01

reporter   ~0070754

Honestly, I didn't understand the history of FontConfig development myself. :-( I quoted an excerpt from somewhere, but now I've looked through old versions of GraphViz, and FontConfig is used everywhere. Clearly, it developed in parallel, capturing distributions and absorbing technologies. However, we are interested in when it "lost" the ability to load fonts from arbitrary directories in conjunction with GraphViz...

In any case, this setting does not work with Windows. Under Linux, the provided directory list is outdated; fonts are now located in different directories.