View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0037018 | mantisbt | performance | public | 2026-04-12 09:17 | 2026-04-18 05:33 |
| Reporter | raspopov | Assigned To | dregad | ||
| Priority | normal | Severity | minor | Reproducibility | always |
| Status | resolved | Resolution | fixed | ||
| Product Version | 2.28.1 | ||||
| Target Version | 2.29.0 | Fixed in Version | 2.29.0 | ||
| Summary | 0037018: The require_once() function is called more times than necessary when loading the API. | ||||
| Description | While investigating issue 0036819, I discovered that the For example, 63 files are loaded from the API via 88 calls for the file | ||||
| Additional Information | The table below lists the API file calls in the order that the | ||||
| Tags | No tags attached. | ||||
|
The high number of require_api() calls is not so surprising, considering the complex inter-dependencies between the various API files in the MantisBT core. Most files are included by core.php, and requiring API files again in individual scripts is often redundant. require_api() was introduced by @dhx in 2010, see MantisBT master 2d5455cc, replacing earlier use of require_once in core.php (MantisBT master ea3cd389). The purpose of these changes was to
That being said, I'm not really sure why he set the flag in the array after the require_once call, maybe the idea was to indicate that the API was fully loaded and available.. In any case, the proposed change goes along the initial intent, so I think it's good, assuming you have tested that changing this does not introduce any regression. |
|
The current use of the flag opens the door to recursive calls, and the flag may be set to 1 multiple times (repeatedly). Furthermore, it is not checked anywhere else except at this point... |
|
|
MantisBT: master 87fdaa05 2026-04-12 09:24 Committer: dregad Details Diff |
Fix extra require_once() calls from require_api() To prevent recursive calls to the require_api() function, move the loading flag after require_once() to before it. Fixes 0037018. |
Affected Issues 0037018 |
|
| mod - core.php | Diff File | ||
|
MantisBT: master 34bbf8f5 2026-04-15 11:05 Committer: dregad Details Diff |
Fix require_lib() in the same way Also arrays has been formatted. Fixes 0037018 |
Affected Issues 0037018 |
|
| mod - core.php | Diff File | ||