View Issue Details

IDProjectCategoryView StatusLast Update
0027217mantisbtbugtrackerpublic2021-03-07 18:29
Reporterdregad Assigned Todregad  
Status closedResolutionfixed 
Target Version2.25.0Fixed in Version2.25.0 
Summary0027217: bugnote_clear_cache() does not work properly

As discussed in 0027200, bugnote_clear_cache() only works as long as the bugnote to remove from $g_cache_bugnotes_by_id has also been stored in $g_cache_bugnotes_by_bug_id, but fails in the scenario where the bug-level cache has not been populated.

Steps To Reproduce
include 'core.php';
$id = 1234;
$note = bugnote_get( $id );
bugnote_clear_cache( $id );
isset( $g_cache_bugnotes_by_id[$id] );   # true -> cache has not been cleared

bugnote_get_all_bugnotes( $note->bug_id );
bugnote_clear_cache( $id );
isset( $g_cache_bugnotes_by_id[$id] );   # false -> now we're ok
TagsNo tags attached.


related to 0027200 new bugnote_update fires EVENT_BUGNOTE_EDIT but does not clear the note cache 




2020-09-02 12:53

developer   ~0064343

Regression was introduced in 1.3.4, MantisBT master-1.3.x 2d8f4c05


Related Changesets

MantisBT: master-1.3.x 2d8f4c05

2016-11-06 15:03:38


Committer: dregad Details Diff
Fix and improve clearing of bug related caches Affected Issues
mod - api/soap/mc_issue_api.php Diff File
mod - core/bug_api.php Diff File
mod - core/bugnote_api.php Diff File
mod - core/file_api.php Diff File
mod - csv_export.php Diff File
mod - excel_xml_export.php Diff File
mod - print_all_bug_page_word.php Diff File

MantisBT: master 68c52650

2020-09-02 12:46:31


Details Diff
Fix bugnote_clear_cache()

bugnote_clear_cache() only removed the note from $g_cache_bugnotes_by_id
if it has also been stored in $g_cache_bugnotes_by_bug_id, but failed in
the scenario where the bug-level cache has not been populated.

Adding a specific unset() call to ensure the bugnote is actually removed
from both caches.

Fixes 0027217
Affected Issues
mod - core/bugnote_api.php Diff File