View Issue Details

IDProjectCategoryView StatusLast Update
0037097mantisbtotherpublic2026-05-04 12:26
Reporterraspopov Assigned Tocommunity  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version2.13.0 
Target Version2.29.0Fixed in Version2.29.0 
Summary0037097: The debug log displays db_query as the calling function for all database calls on Windows
Description

On Windows, helper functions such as db_query, db_query_bound, or plugin_log_event are not stripped from the backtrace, which makes debugging difficult.

Steps To Reproduce

Enable database logging, for example:

$g_log_destination = ‘page’;
$g_log_level = LOG_DATABASE;
Additional Information

This occurs because the log_get_caller method uses the absolute path to files with the folder separator “/” when outputting the backtrace, although on Windows it should be “\”.

TagsNo tags attached.

Activities

raspopov

raspopov

2026-04-25 03:02

reporter   ~0071047

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

Absolute paths and problematic path separators have been removed since the names of functions and files are already sufficiently unique and the location of the MantisBT files can be changed via the configuration.

dregad

dregad

2026-04-27 05:20

developer   ~0071050

Nice catch - I rarely use Mantis on Windows and never realized this was an issue.

I think that use of absolute paths may also be a problem in symlink scenarios, but did not test to confirm.

The bug was likely introduced in 2.13.0 by when logging API was refactored as part of DbQuery class implementation (:mantisbt:7e64b3856:) but I did not actually test earlier versions to confirm if it was also present before.

I attach a couple of screenshots illustrating the issue.

debug_log_linux.png (19,841 bytes)   
debug_log_linux.png (19,841 bytes)   
debug_log_windows.png (19,112 bytes)   
debug_log_windows.png (19,112 bytes)   

Related Changesets

MantisBT: master 898d8680

2026-05-04 11:38

raspopov

Committer: community


Details Diff
Fix debug log backtrace for Windows

Absolute paths and problematic path separators have been removed, since
function and file names are already sufficiently unique, and
the location of MantisBT files can be changed via the configuration.

The text has also been formatted consistently.

Fixes 0037097, PR https://github.com/mantisbt/mantisbt/pull/2209
Affected Issues
0037097
mod - core/logging_api.php Diff File