View Issue Details

IDProjectCategoryView StatusLast Update
0037132mantisbtapi restpublic2026-05-16 12:54
Reporterpiotr.dudkiewicz Assigned Todregad  
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionduplicate 
Product Version2.28.0 
Summary0037132: UI renders incorrectly in CSS1Compat mode after removing UTF-8 BOM; works only in BackCompat/quirks mode
Description

Hello,

after enabling and testing the REST API in MantisBT 2.28, I found an issue related to page rendering mode.

Environment:

  • MantisBT version: 2.28
  • Web server: nginx + PHP-FPM
  • Browser: Chrome
  • REST API enabled with:
     $g_webservice_rest_enabled = ON;

Problem:
The REST API initially failed with:

RuntimeException: Unexpected data in output buffer. Maybe you have characters before an opening <?php tag?
in /vendor/slim/slim/Slim/App.php

After investigation, I found that config/custom_strings_inc.php contained a UTF-8 BOM at the beginning of the file.

With BOM present:

  • REST API fails with the Slim output buffer error.
  • Main UI visually renders correctly.
  • document.compatMode in Chrome returns:
     BackCompat
  • The HTML response starts with several BOM bytes before <!DOCTYPE html>:
     ef bb bf ef bb bf ... 3c 21 44 4f 43

After removing BOM:

  • REST API works correctly.
  • HTML starts correctly with:
    <!DOCTYPE html>
  • document.compatMode returns:
     CSS1Compat
  • However, the MantisBT UI becomes visually broken, as if styles/layout are not applied correctly.

I tested the following:

  • Removed BOM from custom_strings_inc.php.
  • Verified that the response starts with <!DOCTYPE html>.
  • Verified that REST API works after removing BOM.
  • Disabled plugins.
  • Disabled custom_strings_inc.php.
  • Commented custom status configuration.
  • CSS files are loaded with HTTP 200.
  • css/status_config.php returns text/css and valid CSS.
  • PHP syntax check for custom_strings_inc.php reports no errors.
  • The issue still occurs in CSS1Compat mode.
  • As a temporary workaround, removing/commenting the <!DOCTYPE html> output in core/html_api.php forces BackCompat mode and the UI renders correctly while REST API continues to work.

Expected result:
MantisBT UI should render correctly with:

  • no UTF-8 BOM in PHP files,
  • <!DOCTYPE html> present as the first output,
  • document.compatMode = CSS1Compat,
  • REST API working normally.

Actual result:
The UI appears broken in CSS1Compat mode, but renders correctly in BackCompat mode.

Temporary workaround:
Remove/comment <!DOCTYPE html> output in core/html_api.php to force BackCompat mode. This avoids using BOM and does not break REST API, but it is not a proper fix.

Question:
Is this a known issue in MantisBT 2.28, or is there any configuration/CSS setting required to make the UI render correctly in CSS1Compat mode?

TagsNo tags attached.

Relationships

duplicate of 0022143 closeddregad Encoding of custom files not documented 
related to 0022144 new Check content of configuration files 

Activities

raspopov

raspopov

2026-05-15 10:45

reporter   ~0071114

Thanks for the report. Since the custom_strings_inc.php file is not included in the MantisBT distribution, I suspect that your installation has been heavily modified. Could you please attach screenshots showing the correct and incorrect page layout in your browser? Have you used the following tools to check your page markup: https://validator.w3.org/nu/ and https://jigsaw.w3.org/css-validator/ ?

dregad

dregad

2026-05-16 12:54

developer   ~0071118

It has been clearly documented for many years that config files must be encoded in UTF-8 without BOM.

I'm therefore closing this as duplicate of 0022143.

We do have an open issue to improve the admin checks to detect such problems (see 0022144).

As for the display issues you mention, I suspect they are caused by caching or some other local issue. Using custom config files works just fine here.