View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0027200 | mantisbt | bugtracker | public | 2020-09-01 10:17 | 2020-09-05 15:57 |
Reporter | BasCostBudde | Assigned To | |||
Priority | normal | Severity | minor | Reproducibility | always |
Status | new | Resolution | open | ||
Product Version | 2.24.1 | ||||
Summary | 0027200: bugnote_update fires EVENT_BUGNOTE_EDIT but does not clear the note cache | ||||
Description | When a plugin I wrote tried to do something with the updated note, I kept getting the old values. Suggested fix in bugnote_update.php, right after line 80
| ||||
Tags | No tags attached. | ||||
Accessing the global variables directly is not the right way of doing this; you should be calling bugnote_clear_cache() instead, like so:
That being said, to ensure consistent behavior I'm wondering if it would not be cleaner to clear the cache in the bugnote API functions performing updates, i.e. bugnote_set_text(), bugnote_set_time_tracking(), bugnote_set_view_state() and probably bugnote_delete() as well. |
|
The bugnote_clear_cache call, while obviously the way to go instead of meddling with globals, does not remove the entry from the bugnoted_by_id cache structure :( should that be updated in the call as well then? |
|
I didn't actually look at the code, but it sounds like a bug in bugnote_clear_cache(). |
|
Here's what happens with bugnote cache functions:
So the logic only works as long as the bugnote has been stored in $g_cache_bugnotes_by_bug_id, but fails in the scenario where the bug-level cache has not been populated. This can easily be reproduced and confirms the bug : |
|
I opened 0027217 to track the bug in bugnote_clear_cache(). |
|
@atrol @cproensa @vboctor your thoughts on where to put the clear cache calls (see 0027200:0064338) would be appreciated |
|
+1 for that |
|