My application has a base controller that most other classes extend. It is responsible for site-wide tasks such as authentication and building the user model. It uses a few different data models that all extend the ORM.
One of the fields in the user model is called "categories". It's a multi-dimensional array that stores a few arrays of integers (strings really, but you know...we're weakly typed), as well as an HTML string. It looks a little something like this:
Notice that I'm passing "false" to the set_global() method, to disable encoding. I use the "option_list" value to populate a few different select lists around the application.
A recent feature request requires that search data persist between HTTP requests. In the course of modifying a single query, my user model is being affected, but I don't know why. Specifically, the "option_list" is getting encoded. In other words, my "categories" array suddenly looks like this:
I did make other changes to the controller besides this, but by commenting out code I was able to determine that this specific piece of code is the one that is causing the issue.
Digging deeper I found that if I comment out the lines specifically related to the "current_rep", the encoding issue disappears.
I realize that the ORM automatically caches query results. Is it also modifying my existing query data in this case? How can I prevent the encoding from taking place, and why wasn't this issue occurring with the alternate code above? Does it have anything to do with sessions?
The issues was NOT introduced by the code change. The issue existed before, I just didn't realize it. So, the issue is completely unrelated to the code change mentioned above. I do believe it has something to do with the ORM caching.