List:Eventum Development« Previous MessageNext Message »
From:Harri Porten Date:December 9 2005 2:04am
Subject:Caching bug in Issue::getStatusID()
View as plain text  
Hi!

Issue::getStatusID() uses a static array to cache id values of issues:

    function getStatusID($issue_id)
    {
        static $returns;
	// ...
        if (!empty($returns[$issue_id])) {
            return $returns[$issue_id];
        }
        // ...
    }

Doesn't that disregard the possibility that a status has been changed
after it has been queried once? When doing a sequence of calls like

        $oldstatus = Issue::getStatusID($issue_id);
	Issue::setStatus($issue_id, $newstatus);
        if (Issue::getStatusID($issue_id) == $oldstatus)
	    echo "Status unchanged!";

the result will always be "Status unchanged".

The cache might be a good idea but shouldn't it rather be an ordinary
member variable that is updated on setStatus() calls?

Harri.

Thread
Caching bug in Issue::getStatusID()Harri Porten9 Dec
  • Re: Caching bug in Issue::getStatusID()Bryan Alsdorf14 Dec