Re: Oracle connection problem after call to unserialize()
| From: | Miguel Carvalho | Date: | Tue, 24 Sep 2002 13:19:17 +0000 |
| Subject: | Re: Oracle connection problem after call to unserialize() | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-21964@lists.php.net to get a copy of this message | ||
> I made a class called OracleCon that is used to connect to an Oracle
> server and provide some certain queries to the database
> When i create an object of that class and serialize it to add it to a
> cookie, if i echo the $object->connection attribute i get a "Resource
> id #2"
>
> When after redirection due to succefull login, i need to use this
> object to run the queries i get an error like this:
>
> Warning: ociparse(): supplied argument is not a valid OCI8-Connection
> resource in c:\program files\apache
> group\apache\htdocs\php\OracleCon.inc on line 66
>
You cant't serialize a object that uses as a member a "resource"( let's
say an handler ).When PHP end the script, it will close all handler's used( database
connecitons, files, etc ).
You have to store the login information in a session var or in the database.
> If i echo the $object->connection attribute again i get a "0"!!!! If i
> echo the other attributes, they have the same values as they were set
> before serialization of the object
Handler's are not serializable var's.
Miguel