Object can not be used after a session
| From: | Matt Silva | Date: | Tue, 15 Jul 2003 22:39:26 +0000 |
| Subject: | Object can not be used after a session | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-155326@lists.php.net to get a copy of this message | ||
Hi I was wondering if anybody has any Ideas about or has experienced
this....
I create a new object and then assign it to a session var
$customer = new Customer($_GET['facilityID'], $_GET['customerID']);
$_SESSION['acceptPayment']['customer'] = $customer;
but later when I access that session var [in the the same file but in a different function and different instance], php gives me an error saying:
"The script tried to execute a methode or access a property of an incomplete object. Pleas ensure that the class definition lt;bgt;customerlt;/bgt; of the object you are trying to operate on was loaded _before_ the session was started
at <filepath>/acceptPayment.php line 103"
I did a little reading (rtfm) on php.net and saw that if session.auto_start is turned on, you couldn't use Objects with sessions. Well I checked my ini and the session.auto_start was set to 0, so I am now scratching my head in confusion.
I require_once the Customer class and start the session after the requires and includes, so then I thought ok require_once
so I change it to require and then it doesn't load the class the for some reason (sigh).
Thanks for your help in advance
Matt