#25929 [Opn->Bgs]: cannot read cookies within included file
| From: | sniper@php.net | Date: | Tue, 21 Oct 2003 19:17:07 +0000 |
| Subject: | #25929 [Opn->Bgs]: cannot read cookies within included file | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-49300@lists.php.net to get a copy of this message | ||
ID: 25929
Updated by: sniper@php.net
Reported By: joe at kybert dot com
-Status: Open
+Status: Bogus
Bug Type: Variables related
Operating System: XP (debug server)
PHP Version: 4.3.2
New Comment:
If you include REMOTE file, of course the cookie is not passed to it.
Previous Comments:
------------------------------------------------------------------------
[2003-10-21 13:18:10] joe at kybert dot com
nope, same problem.
Did you use the source code that i posted?
joe
#
------------------------------------------------------------------------
[2003-10-21 10:28:29] jay@php.net
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
------------------------------------------------------------------------
[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