Re: Cookie error after 4.2.3 upgrade

From: Date: Fri, 08 Nov 2002 08:54:38 +0000
Subject: Re: Cookie error after 4.2.3 upgrade
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-123340@lists.php.net to get a copy of this message
Jack Sasportas wrote: > I get the following error when using a previously working cookie > function: expects parameter 3 to be long > > Code is below... I just don't see the difference then the way the doc > uses: time() - 3600 > > -vs- the way I did it below... > > Thanks ! > > function > f_put_cookie($user_name,$user_email,$account_type,$company_name) { > > global $HTTP_COOKIE_VARS; > global $s_c_url; > > $l_url = ".".$s_c_url; > $l_cookie_expireN = date('r', time() - 4000 ); > $l_cookie_expire = date('r', time() + 400 ); > $l_cookie_expire2 = date('r', time() + 400*30*12 ); time() - 3600 returns an integer. The date function returns a string. The function setcookie expects an integer (or long) as parameter 3. There's your problem, change your code to: $l_cookie_expireN = (int) date('r', time() - 4000 ); $l_cookie_expire = (int) date('r', time() + 400 ); $l_cookie_expire2 = (int) date('r', time() + 400*30*12 ); HTH Erwin

« previous php.general (#123340) next »