I believe you are correct. IIRC some of the times we've attempted to simply swap `our` for `my` it has created issues with the code. Swapping the variable for a caching mechanism definitely sounds like the way to go! I'm seeing a lot of `our` keywords that appear to be functionally constants, and should be changed to constants.Kyle---http://www.kylehall.info
ByWater Solutions ( http://bywatersolutions.com )
Meadville Public Library ( http://www.meadvillelibrary.org )
Crawford County Federated Library System ( http://www.ccfls.org )On Wed, Mar 12, 2025 at 6:56 AM Tomas Cohen Arazi via Koha-devel <koha-devel@lists.koha-community.org> wrote:_______________________________________________I'm not sure why we didn't do it already, but running Koha in a persistent context has become the standard.This means variables defined as `our $variable` will persist in memory while workers run. And this is dangerous for several reasons. The most obvious one is that sometimes the code expects the caller to pass a parameter and checks if it is defined, and using `our` might make it defined when it shouldn't.If the reason to use it is caching, then it is a bad pattern anyway. We should be using the in-memory cache (lite) explicitly so everyone knows the value is expected to be fetched from a cache.Looking forward to hear your thoughtsPS interestingly, I found this while finding the root cause for some files not being tidied :-P--Tomás Cohen Arazi
Koha-devel mailing list
Koha-devel@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
website : https://www.koha-community.org/
git : https://git.koha-community.org/
bugs : https://bugs.koha-community.org/