From:             joe at kybert dot com
Operating system: XP (debug server)
PHP version:      4.3.2
PHP Bug Type:     Variables related
Bug description:  cannot read cookies within included file

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 bug report at http://bugs.php.net/?id=25929&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=25929&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=25929&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=25929&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=25929&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=25929&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=25929&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=25929&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=25929&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=25929&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=25929&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=25929&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=25929&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=25929&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=25929&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=25929&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=25929&r=float

Reply via email to