View Issue Details

IDProjectCategoryView StatusLast Update
0037391mantisbtcustom fieldspublic2026-09-16 09:47
Reporterc_schmitz Assigned To 
PrioritynormalSeverityblockReproducibilityalways
Status newResolutionopen 
Product Version2.28.4 
Summary0037391: Editing/viewing a custom field can make an unrelated custom field "disappear" and break the page
Description

MantisBT keeps a temporary lookup that maps custom field names to their IDs. If a page happens to load just one specific custom field first (for example, opening the "Edit Custom Field" page for a single field), that lookup gets partially filled in — but the system then wrongly assumes it's fully filled in. Any later attempt on that same page to find a different custom field by name will incorrectly report that it doesn't exist, even though it does.

In practice, we saw this cause a real crash: our site has a plugin that looks up a custom field called "Bug heat" by name whenever an issue number is shown as a link (e.g. in "Recently Visited"). If that link is shown on a page that just loaded a different custom field first, the plugin gets told "Bug heat" doesn't exist, and the whole page fails with a fatal error instead of just showing the link.

Steps To Reproduce

1.) Have two or more custom fields set up (e.g. "Field A" and "Bug heat"), both linked to a project.
2.) Open the "Edit Custom Field" admin page for "Field A" specifically (by its ID).
3.) On that same page, have something (a plugin) look up the "Bug heat" field by name (this happens automatically if the BugHeat plugin is installed, because it runs whenever a recently-visited issue link is displayed).
4.) The lookup for "Bug heat" incorrectly fails, even though the field exists and is properly set up.

Expected result: Looking up a custom field by name should always find it if it exists, no matter what else was looked up earlier on the same page.

Actual result: The lookup returns "not found," and (with plugins like BugHeat that don't expect this) the page can crash with a fatal "Custom field not found" error.

Additional Information

Where to look: custom_field_get_id_from_name() in core/custom_field_api.php — it only rebuilds its full name lookup when the cache is completely empty, rather than checking whether it was ever fully built.

I will submit a PR and add the link here, later.

TagsNo tags attached.