Re: [PHP-DOC] Documentation for setcookie()? From: Derick Rethans (derick <email protected>)
Date: 10/09/02

On Tue, 8 Oct 2002, Erica Douglass wrote:

> I was using PHP with some other people today, and one of them found out
> that I had access to the manual to update it. He said he had experienced
> the following problem:
>
> Their dev server was running an older version of PHP (4.0.x). Their
> production server was running 4.2.x. He was using the following code to
> delete a cookie:
>
> setcookie($name, $value, '/', '')

This should be: setcookie($name, $value, 0, '/') iirc.

>
> He said that the behavior changed in two ways between 4.0.x and 4.2.x:
> 1. Single quotes for setcookie() are no longer allowed.

Single quotes are handled (almost) the same as double quotes. I really
don't believe single quotes dont work any longer.

> 2. Expiration date must be 0, not an empty string.

The manual shows:
boolean setcookie ( string name [, string value [, int expire [, string path [, string domain [, int secure]]]]])

the expire parameter is listed as an INT here, which means it's not a
string.
 
> I looked at the setcookie() documentation and it didn't seem to mention
> this specifically. I'm not sure whether this needs to be added, since
> I'm not familiar with setcookie() myself. Could someone comment on why
> this changed and whether that should be added to the manual?

It is possible that more aggresive checking for parameters came in to
place, from the source I see that happened.

Derick

--

--------------------------------------------------------------------------- Derick Rethans http://derickrethans.nl/ JDI Media Solutions --------------[ if you hold a unix shell to your ear, do you hear the c? ]-

-- PHP Documentation Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php