title: Why can't I store a PHP class instance as a SESSION variable
body: <p>I have a PHP script that is called in 2 ways from a Dojo Ajax xhrGet call.
  The first time it is called with an "init" argument which causes the script to create an instance of the StateList class and read in a file of state names.</p>
  
  <pre><code>session_start();
  @include('StateList.php');
  require_once('phplog.php');
  
  //start executing here
  $comd=$_GET['nexturl'];
  if($comd=="init") {
  $st = new StateList("../data/statestxt.txt");
  $_SESSION['statefile'] = $st;
  }
  </code></pre>
  
  <p>The second and further times, another xhrGet call passes a "getstate" argument and the following code tries to get the instance ofr the StateList class from the SESSION array.</p>
  
  <pre><code>if($comd =="getstate") {
  $st= $_SESSION['statefile'];
  phplog("size=".$st-&gt;getSize());
  </code></pre>
  
  <p>}</p>
  
  <p>However, the getSize() method is never executed, nor can I call any other method
  on the reconstituted StateList class instance.</p>
  
  <p>Note that this is one PHP script that DOES include the class definition at the top
  and thus the class methods should be known and avaialble. </p>
  
  <p>What am I missing here?</p>