I'm using the library HTTP_OAuth that we can download directly in a
pear package: http://pear.php.net/package/HTTP_OAuth/ and I've got a
problem when I serialized the consumer in order to have it in my web
application:
I serialize in a .php page:
<code>
$consumer->getAccessToken(params);
$_SESSION['consumer'] = serialize($consumer);
</code>
and in other .php page:
<code>
$consumer = unserialize($_SESSION['consumer']);
</code>
In the first page, before the serialization, if I make a print_r of
the consumer, we can see this:
<code>
[adapter:protected] => HTTP_Request2_Adapter_Curl
Object
(
[eventSentHeaders:protected] => 1
[eventReceivedHeaders:protected] => 1
[position:protected] => 0
[lastInfo:protected] => Array
(
[url] =>
[...]
</code>
and after de unserialization:
<code>
[...]
[adapter:protected] => __PHP_Incomplete_Class
Object
(
[__PHP_Incomplete_Class_Name] =>
HTTP_Request2_Adapter_Curl
[eventSentHeaders:protected] => 1
[eventReceivedHeaders:protected] => 1
[position:protected] => 0
[lastInfo:protected] => Array
(
[url] =>
[...]
</code>
Anyone knows what can I do to make this serialize thing works?
Maybe it is a simple question, but I don't know how to solve it...
Thanks a lot!
Elllore
Hi Ellore,
when using unserialize(), you have to make sure that the classes that
are being deserialized are already available in your code at that point.
So you should add the necessary require() statements above your
unserialize() line, that should help with this "incomplete class" situation.
I however do not exactly know which file to include for this specific
"HTTP_Request2_Adapter_Curl" class... its somewhere in PEAR probably.
Arjan
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAktywkYACgkQigE4AbflYermYwCgrZVltnyC84v2a2+6CE+HcSF2
+hkAmwe/gJrVFHSs+r2Bu9Qlo/x3uFpN
=t41b
-----END PGP SIGNATURE-----