You’re getting the error “The script tried to execute a method or access a property of an incomplete object” after trying to access a property or method of an object you’ve stored in a $_SESSION variable in your PHP.
You’ve probably got some code that looks like this:
… trying to do something with the object, it’ll fail …
Change it to this:
… trying to do something with the object, it’ll work …
As you can see including your class definitions before you start the session (where your object is) is what makes this work.
So fine, PHP needs to know about your class definitions before you can access a session object that makes use of that class, makes sense to me, now.
It’s tripped me up a few times because a) I don’t do a ton of PHP programming, so I forget, and b) I’ve always understood that session_start() should be the first line of code in a script. However, the latter is not the case if you’re doing OOPHP and working with classes. I’ll need to run this by my mentors, who are very procedural in their PHP.
Am I missing something, anyone?