PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » HTTP » HTTP_Client » Bug #9142

Cookies deleted on serialization

Details

Request #9142Cookies deleted on serialization
Submitted2006-10-23 18:51 UTC
Fromyap at yapsoft dot it
StatusDuplicate
PackageHTTP_Client
PHP Version4.3.10
OSLinux 2.6
Roadmaps(Not assigned)

Comments

[2006-10-23 18:51 UTC] yap at yapsoft dot it

Description:
------------
The member __sleep of the class HTTP_Client_CookieManager deletes cookies without expire time.
If you use HTTP_Client to connect to a password protected website (php protection) you have to reauthenticate everytime and you lose the benefit of persistent HTTP_Client.

[2007-02-05 05:39 UTC] arailean at squiz dot net

See Bug #8778
To find out that this is not considered a bug by the maintainer.

http://pear.php.net/bugs/bug.php?id=8778

[2007-02-27 03:56 UTC] bogus at something dot com

Here's what I did as a workaround:
Instead of serializing the object just serialize the vars:

$vars = get_object_vars($cookieman);
$serialized = serialize($vars);

To load them back into the object do:

$cookieman = new HTTP_Client_CookieManager();
$vars = unserialize($serialized);
foreach($vars as $var_k => $var_v){
$cookieman->{$var_k}=$var_v;
}

I'm new to php(and I don't really want to learn it) so this might(read won't) be the best solution ;)

HTH
Michael Walloch