Does PHP do any kind of caching of objects on it's own? If you construct something once, then construct the same exact thing again later, does PHP reconstruct it a second time, or just use the firstly already constructed object, because they're identical objects.
deserialising PHP objects can cause code execution, their constructors and wakeup methods run, by the time you get to an instanceof check, it's already happened
I've got the object available and ready at a certain event hook. The problem I've been facing is getting it to the functions which need it. I don't want to be passing variables from a() -> b() -> c() -> d(), etc. Just seems messy. My way around it was to make a getter function to retrieve the object. I can get it when needed and not have to pass it from function to function in a chain like approach.
That's why I was storing it in DB, but now I'm having second thoughts
Let me tell you it was so much easier doing it the "WP way". Create the object once, then just global it everywhere.
Welcome to the Stack Overflow Podcast #102 recorded Thursday, February 23, 2017 at the Stack Overflow HQ in NYC. Today's podcast is brought to you by rogue cows and SHA-1. SHA-1: You can depend on it.