Bug #14255 Updated: setcookie bug (Cookie is destroyed/Inaccessible)

From: Date: Tue, 27 Nov 2001 19:28:16 +0000
Subject: Bug #14255 Updated: setcookie bug (Cookie is destroyed/Inaccessible)
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-71856@lists.php.net to get a copy of this message
ID: 14255
Updated by: sander
Reported By: kris.wilkinson@titancs.com
Status: Open
Bug Type: HTTP related
Operating System: Debian 2.2.19
PHP Version: 4.0.6
New Comment:

IIRC, no time (time=0) means that the cookie will not expire until the session (read: your browser)
has been closed.

Your scripts work fine for me at both Windows 2000 and Debian Linux (Potato).

Previous Comments:
------------------------------------------------------------------------

[2001-11-27 13:59:12] kris.wilkinson@titancs.com

array(4) { ["xfxdD"]=> string(4) "Blah" ["wingrep"]=> array(4) {
["customer_cookie"]=> string(10) "1150232722" ["customer_id"]=>
string(1) "1" ["customer_name"]=> string(13) "Mr. Wilkinson"
["customer_province"]=> string(2) "BC" } ["titancart"]=>
array(1) { [0]=> string(72) "33a63c7718-component-1715-108.95-1-Adaptec Fireconnect 4300 3
Port-2.00*" } ["wingrepship"]=> array(7) { ["ship_to"]=> string(18)
"Mr. Kris Wilkinson" ["unit_type"]=> string(5) "SUITE"
["unit_num"]=> string(3) "101" ["street"]=> string(18)
"10464 176th Street" ["city"]=> string(8) "Edmonton"
["province"]=> string(2) "BC" ["postal"]=> string(7) "T5R
3L6" } } 

is what it returns. nothing containing the CustomerCookie
defined previously.

these other values are from original cookies which had the 
"" around the time aspect.

so i'm assuming this means that the value was not stored in a cookie at all?


------------------------------------------------------------------------

[2001-11-27 13:59:04] kris.wilkinson@titancs.com

array(4) { ["xfxdD"]=> string(4) "Blah" ["wingrep"]=> array(4) {
["customer_cookie"]=> string(10) "1150232722" ["customer_id"]=>
string(1) "1" ["customer_name"]=> string(13) "Mr. Wilkinson"
["customer_province"]=> string(2) "BC" } ["titancart"]=>
array(1) { [0]=> string(72) "33a63c7718-component-1715-108.95-1-Adaptec Fireconnect 4300 3
Port-2.00*" } ["wingrepship"]=> array(7) { ["ship_to"]=> string(18)
"Mr. Kris Wilkinson" ["unit_type"]=> string(5) "SUITE"
["unit_num"]=> string(3) "101" ["street"]=> string(18)
"10464 176th Street" ["city"]=> string(8) "Edmonton"
["province"]=> string(2) "BC" ["postal"]=> string(7) "T5R
3L6" } } 

is what it returns. nothing containing the CustomerCookie
defined previously.

these other values are from original cookies which had the 
"" around the time aspect.

so i'm assuming this means that the value was not stored in a cookie at all?


------------------------------------------------------------------------

[2001-11-27 13:48:49] kris.wilkinson@titancs.com

Not to sound offensive, have you actually tried it?

I've pasted exactly what you just sent back to me, and it wont go.

There have been many comments in the newsgroups and the function page itself about this issue ...

people are having to put quotations around the time aspect in order to get it to work at all, and
according to you, that would set the value to zero right?

-> cookie.php 

<?php

       setcookie ('CookieName', 'CookieValue', time()+7200);
       header ("Location: cookie2.php");
        
?>   

-> cookie2.php

<?php

        $cookie = $HTTP_COOKIE_VARS[CookieName];
        echo $cookie;
        
?>

that's exactly the test script i'm using. 

Is there anything wrong with the above? 



------------------------------------------------------------------------

[2001-11-27 13:43:03] sander@php.net

setcookie ('CookieName', 'CookieValue', time()+7200);
works. If not you're doing something wrong.
This is NOT a bug in PHP. Ask further support-questions on the appropriate mailinglist
(php-general@lists.php.net).



------------------------------------------------------------------------

[2001-11-27 13:40:30] kris.wilkinson@titancs.com

ANd now .... it's not working again.

Suggestions please!

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/?id=14255


Edit this bug report at http://bugs.php.net/?id=14255&edit=1



Thread (20 messages)

« previous php.dev (#71856) next »