#25929 [Opn->Fbk]: cannot read cookies within included file
| From: | jay@php.net | Date: | Tue, 21 Oct 2003 14:28:29 +0000 |
| Subject: | #25929 [Opn->Fbk]: cannot read cookies within included file | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-49283@lists.php.net to get a copy of this message | ||
ID: 25929
Updated by: jay@php.net
Reported By: joe at kybert dot com
-Status: Open
+Status: Feedback
Bug Type: Variables related
Operating System: XP (debug server)
PHP Version: 4.3.2
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php4-STABLE-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php4-win32-STABLE-latest.zip
4.3.2 is too old. Try using a recent snapshot, as 4.3.4 is
just around the corner and this bug (if it is a bug) may
already be fixed. (I can't reproduce at any rate.)
J
Previous Comments:
------------------------------------------------------------------------
[2003-10-20 19:59:26] joe at kybert dot com
Description:
------------
Cookie is not readable across multiple files.
I have 2 files, file 1 sets a cookie (refresh file after 1st exe so
cookie is sent)
it then includes file 2, which reads and displays the cookie.
Both files are in the same folder on the server, which is
<servername>/test/<filenames>
.
File 2 fails to read the cookie!
Reproduce code:
---------------
file1.php contains:
<?php
setcookie("test", "set_by_file_1", time()+3600, "/",
$_SERVER['HTTP_HOST']);
echo "file 1 cookies: ";
print_r($_COOKIE);
include("http://$SERVER_NAME/test/file2.php");
?>
file2.php contains:
<?php
echo "<br>file 2 cookies: ";
print_r($_COOKIE);
?>
Expected result:
----------------
file 1 cookies: Array ( [LastUser] => ujoe [test] => set_by_file_1 )
file 2 cookies: Array ( [LastUser] => ujoe [test] => set_by_file_1 )
Actual result:
--------------
file 1 cookies: Array ( [LastUser] => ujoe [test] => set_by_file_1 )
file 2 cookies: Array ( )
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=25929&edit=1