Dec 11

PHP Objects and Sessions

Tags: , ,
Posted in:Tech | 3 Comments »

We stumbled across an interesting issue at work today with the Zend Framework and objects.  We’re working on a filter for a series of reports that carries over from page to page and in the process of development, decided it would be best to move this from page to page within an object.

The error we were receiving while doing so however was “The script tried to execute a method or access a property of an incomplete object.”  Doing a bit of reading up on php.net, it turns out that php serializes an object, then when the session is started, it unserializes the object.  You won’t actually find out there’s a problem until you call a method that is supposed to reside within the object.

The work around for this problem is loading the class into memory before starting your session.  In our situation, we’re running the Zend Framework which start’s the session on it’s own and it seems unsensible to modify the Zend libraries but we still had a problem with an incomplete object.  Thus on my path to finding a way to work around this problem, I created class.cow.php.

Read the rest of this entry »


HEY! Did you eat my pickle... or did I?
-Kyle Berg

  • Josh
  • Nothing to Say
  • Plastic Metal
  • Shoe False Fiction