|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-09-08 17:21 UTC] rasmus@php.net
[2004-09-15 14:17 UTC] p dot kruijsen at mssm dot nl
[2004-09-15 14:21 UTC] derick@php.net
[2004-09-15 17:00 UTC] rasmus@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Dec 08 05:00:01 2025 UTC |
Description: ------------ When include()ing a url through HTTP, $_SESSION variables in the requested page are lost. Opening the same url by hand does preserve the $_SESSION variables. Testcase: Bootstrap a session variable on server1. (OK) Test bootstrap by invoking script on server1. (OK) Invoke script on server2 that includes script on server1. ($_SESSION is lost) This behaviour occurs on various operating systems with various up to date versions of PHP. I suspect this to be some form of security guarantee built into PHP. However, I see no difference in security level between include()ing a file in a script and opening it by hand. Reproduce code: --------------- <?php // server1.com/bootstrap.php session_start(); $_SESSION['bootstrap'] = 'OK'; echo('OK'); ?> <?php // server1.com/test.php session_start(); $_SESSION['server1'] = 'OK'; echo('<pre>server1: $_SESSION = '); print_r($_SESSION); echo('</pre>'); ?> <?php // server2.com/test.php session_start(); include('http://server1.com/test.php'); $_SESSION['server2'] = 'OK'; echo('<pre>server2: $_SESSION = '); print_r($_SESSION); echo('</pre>'); ?> Expected result: ---------------- // invoke server1.com/bootstrap.php OK // invoke server1.com/test.php server1: $_SESSION = Array ( [bootstrap] => OK [server1] => OK ) // invoke server2.com/test.php server1: $_SESSION = Array ( [bootstrap] => OK [server1] => OK ) server2: $_SESSION = Array ( [server2] => OK ) Actual result: -------------- // invoke server2.com/test.php server1: $_SESSION = Array ( [server1] => OK ) server2: $_SESSION = Array ( [server2] => OK ) // Ths initial bootstrap variable is missing from $_SESSION on server1